PREfast Warning 235 (Windows CE 5.0)
235 - (<non-zero constant> || <expression>) is always TRUE.
Question: Was the bitwise-or operator intended?
This warning indicates that a constant value greater than one was detected on the left side of a logical-OR operation that occurs in a test context.
The resulting expression always evaluates to TRUE and any side effect occurring on the right side of the expression is lost.
A constant value greater than one suggests that | or & might have been intended. If not, consider using a constant that evaluates to 1.
Example
Defective Source
int n = 15;
if (2 || n) {;}
Corrected Source
int n = 15;
// Explicitly show that side effects of n are unimportant.
if (2 /* || n */) {;}
// Change the constant to 1. */
if (1 || n) {;}
// Change the operator to |.
if (2 | n) {;}
Send Feedback on this topic to the authors