HP Code Advisor Diagnostics Reference Guide (5900-1865, July 2011)

case 2: printf("Two\n");
break;
case 3: printf("Three\n");
case 4: printf("Four\n");
default: printf("Bye\n");
}
return 0;
}
Action:
This warning is issued to ensure that the missing breaks between the different case values is
expected.
Reference:
2.154 4372 Potential overflow in arithmetic expression involving
time_t/clock_t values
Cause:
When arithmetic expressions that involve time_t/clock_t values overflow, the code may behave
incorrectly.
Example:
#include <stdio.h>
int main() {
int i;
time_t t1 = 1024;
scanf("%d", );
if (t1+=i, t1 < 10) {
t1 *= i;
}
return 0;
}
The expressions t1 += i, and t1 *= i can cause overflow and needs to be explicitly checked.
Action:
If there is no explicit check for overflow after arithmetic expressions on time_t/clock_t values, add
a check.
Reference:
2.155 4373 non arithmetic integer conversion resulted in a change of
sign
Cause:
When assigning hexadecimal or octal values to an integer type, if the data causes a change in
the sign of the type, this warning is displayed.
Example:
int main()
{
short i = 0xFFFF;
short j = 0x10000;
return 0;
}
Action:
Check for hexadecimal or octal constant, which though fitting in the integral type mentioned, causes
a sign change.
Reference:
70 Diagnostics Details