HP Code Advisor Diagnostics

Two calls to an unprototyped function differ in the number of arguments being passed, at least
one of these calls is passing wrong arguments.
Example:
int main() {
foo(10);
foo(10, 100);
}
Action:
Correct the function call which is passing wrong number of arguments. Preferably declare the
function before calling it.
Reference:
4248 comparison of unsigned integer with a signed integer
Cause:
This occurs due to mixing signed and unsigned operands with relational operators <, ≤, >, ≥. One
of the operands in signed and the other unsigned. The signed quantity may be negative as well.
Example:
int a = -1;
unsigned int b = 1;
if (a < b)
return a;
Action:
To resolve this problem, either cast the integer to unsigned if you know it can never be less than
zero or cast the unsigned to a signed int if you know it can never exceed the maximum value of
int.
Reference:
4249 64 bit migration: value could be truncated before cast to bigger
sized type.
Cause:
The size of the result of an operation is determined based on the size of the operands and not
based on the type into which the resultant value is being castled. If the result exceeds the size of
the operands, in this case 32 bits, it will be truncated even before the cast takes place.
Example:
void foo(int data) {
long data1 = (long) (data << 16); // warning 4249 here
long data2 = ((long)data) << 16; // no warning
}
Action:
If you expect the value of the result to exceed the size of the type of operands then cast the
operands to the bigger type before the operation.
Reference:
4251 the assignment has an excessive size for a bit field
Cause:
The constant has a larger value than that can be stored in the bit-field.
Example:
4248 comparison of unsigned integer with a signed integer 61