HP Code Advisor Diagnostics

return 0;
for(int a = 0; a < 3; a++) {
if (a == 1)
return 1;
}
}
Action:
If the loop is necessary, change the code such that the loop can be reached. Otherwise, remove
the loop.
Reference:
2144 a value of type %t1 cannot be used to initialize an entity of type
%t2
Cause:
Initializing an entity of some type with incompatible types.
Example:
typedef char* addr;
int main() {
addr data = "0x1";
int bar = data;
return 0;
}
Action:
Initialize an entity of some type with the same type or compatible types. Or use appropriate cast
operator to convert one operand to the other.
Reference:
2147 declaration is incompatible with %nfd
Cause:
The declaration or definition provided is incompatible with a previous declaration.
Example:
class Init {
static const float fmem;
};
float Init::fmem = 10.0f;
Action:
Check if given declaration/definition is consistent with the previous declaration. For example,
the qualifiers might be missing, the type declared might be different etc. The given example can
be corrected as follows: class Init { static const float fmem; }; const float Init::fmem = 10.0f;
Reference:
2152 conversion of nonzero integer to pointer
Cause:
The compiler has detected the conversion of a non-zero integer to pointer. Such conversions
might lead to undesirable behavior.
Example:
#define DT 10
32 Diagnostics Details