HP Code Advisor Diagnostics Reference Guide (5900-1865, July 2011)
Example:
int main() {
if (1) ;
}
Action:
Check if you inadvertently inserted a ';'.
Reference:
2.143 4315 %s loop without body, did you insert an extra ';'?
Cause:
The loop statement does not have a body.
Example: for (i=0; i<10; i++) ; // warning 4315 here
Action:
Check if you inadvertently inserted a ';'.
Reference:
2.144 4354 One of the operands of the %sq operation is a string literal,
strcmp() is recommended for such comparison
Cause:
If the character pointer is compared with a string literal, then the result is unspecified.
char *ch_ptr = "hello";
if(ch_ptr == "world") { }
Action:
Use of '==' to compare 2 strings is unusual and might be done by mistake - check if you should
be using strcmp() instead.
Reference:
2.145 4355 the initializer for %n is greater than %s
Cause:
This warning is issued when a large sized array (greater than 32 MB) is getting initialized in the
program.
enum try_stuff {try_array= 0x08000000};
char try[try_array*4] = {1,2,[try_array*4-1]=10 };
Action:
It is safe to create an array of size less than 32 MB.
Reference:
2.146 4356 operand of sizeof is a constant rvalue, this might not be what
you intended
Cause:
This warning is issued for sizeof(x) where x is a constant rvalue.
Example:
#include <stdio.h>
#define CONST 10
int foo()
{
printf("%u\n",(unsigned) sizeof(10)); // Issue warning
66 Diagnostics Details