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

2.130 4278 the sub expression in logical expression is a constant
Cause:
Logical operators follow short-circuit evaluation - if the first operand of a logical || or && operator
determines the result of the expression, the second operand will not be evaluated. In the given
expression the first sub expression is a constant that determines the result of the expression and
hence the rest of the expression will never be evaluated.
Example:
int main() {
int a = 10;
if( 10 || (a == 10))
return 0;
}
Action:
Check if the constant is expected. In some cases the constant value might be the result of a valid
macro expansion, in such scenarios you can suppress this warning for the particular macro using
the +Wmacro option.
Reference:
2.131 4279 the expression depends on order of evaluation
Cause:
The expression modifies a variable more than once without an intervening sequence point OR the
expression modifies a variable and fetches its value in a computation that is not used to produce
the modified value without an intervening sequence point. The final value of such expressions is
undefined.
Example:
i = i++; // warning 4279 here
x = i + ++i; // warning 4279 here
i = i + 1; // no warning here
Action:
Rewrite the expression so that each variable is modified only once before a sequence point OR if
a variable is modified, it is fetched only to compute the value to be stored in the variable (ex i =
i+1).
Reference:
C99 6.5, ANSI/ISO C++ 5.4
2.132 4281 assignment in control condition
Cause:
An assignment operator = was found where an equality operator == might have been intended,
ex in an if condition expression. While using the assignment operator is valid such expressions
often turn out to be bugs in the user's program.
Example:if (a = b) ...
Action:
Check if the assignment operator is what was intended.
Reference:
62 Diagnostics Details