Compartilhar via


PREfast Warning 240 (Windows CE 5.0)

Send Feedback

240 - (<expression> && <non-zero constant>) always evaluates to Boolean result of <expression>.
Question: Was the bitwise-and operator intended?

This warning indicates that a constant value greater than one was detected on the right side of a logical-AND operation that occurs in a test context.

This expression reduces to a constant value of !!n, which is 0 or 1.

This warning is typically caused by an attempt to mask bits, in which case the operator should be &.

Example

Defective Source

if (x && 3) {;}

Corrected Source

if (x & 3) {;}

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.