다음을 통해 공유


PREfast Warning 239 (Windows CE 5.0)

Send Feedback

239 - (<non-zero constant> && <expression>) 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 left 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 (3 && x) {;}

Corrected Source

if (3 & x) {;}

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.