PREfast Warning 286 (Windows CE 5.0)
286 - (<non-zero constant> || <expression>) is always TRUE.
Consequence: <expression> is never evaluated and may have side effects.
This warning indicates that a nonzero constant was detected on the left side of a logical-OR operation that occurs in a test context.
The resulting expression always evaluates to TRUE. In addition, the right side of the expression appears to have side effects, and they will be lost.
This warning indicates that you might want to examine the right side of the expression carefully to ensure that side effects needed for proper functionality are not lost.
The (!0 || <expression>) construction is commonly used to force execution of a controlled block.
Example
Defective Source
if (1 || MyFunction()) {;}
Corrected Source
if (1) {
MyFunction();
;
}
Send Feedback on this topic to the authors