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

Table Of Contents
ANSI/ISO C++ 18.1(5)
4272 conversion from %t1 to %t2 may lose sign
Cause:
The Compiler has detected conversion from a signed data type to an unsigned data type. This
may lead to loss of sign.
Example:
typedef unsigned int uint32_t;
void foo(int j) {
uint32_t k;
k = j;
}
Action:
If this is intended then add a cast.
Reference:
4273 floating-point equality and inequality comparisons may be
inappropriate due to round off common in floating-point computation
Cause:
Since floating point numbers are usually subject to rounding-off errors, comparison between
non-constant floating point values may not always be accurate.
Example:
bool check(float v1, float v2) {
return ( v1 == v2 );
}
Action:
Change your program logic to not depend on such comparisons.
Reference:
4274 comparison of pointer with integer zero
Cause:
A pointer is being compared with an integer zero. Equality comparison with integer zero is allowed
for checking if the pointer is null but other comparisons like >, <, and ≤are not valid.
Example:
int main() {
char* ptr = 0;
if(ptr >= 0)
return 1;
}
Action:
Rewrite the expression to use == or !=.
Reference:
4275 constant out of range (%s) for the operator
Cause:
For a given relational operation the constant is out of range specified by the other non-constant
operand.
60 Diagnostics Details