HP-UX Cadvise Diagnostics Reference Guide (5900-1865, August 2012)

Table Of Contents
Action:
For portable code change the way these values are accessed. If the order in which the values are
accessed is not important then first cast the pointer to void* type and then cast to the lesser integer
type.
Reference:
4295 abstract function type declared with empty parentheses, consider
replacing with parameter list or void.
Cause:
The declaration of function has an empty parameter list. If the function has parameters, they should
be declared here; if it has no parameters,void should be specified in the parameter list.
Example: void foo(long (*compar) ()) ;
Action:
The recommended way to declare a function that takes no parameters is to use void in the parameter
list.
Reference:
4298 64 bit migration: addition result 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 size of variable in which the resultant value is stored. If the result exceeds the size of the
operands, in this case 32 bits, it will be truncated even before the assignment takes place.
Example:
void foo(int data) {
long data1 = data + 16; // warning 4298 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 addition else use same type for operands and result.
Reference:
4299 64 bit migration: multiply result 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 size of variable in which the resultant value is stored. If the result exceeds the size of the
operands, in this case 32 bits, it will be truncated even before the assignment takes place.
Example:
void foo(int data) {
long data1 = data * 16; // warning 4299 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 multiplication else use same type for operands and result.
64 Diagnostics Details