Click on image to see enlargment
Why does this C program print '1' rather than '0'?
bug514.c lint Output
--- Module: bug514.c _ if( u & Raining == 0 ) return 0; bug514.c(7) : Warning 514: Unusual use of a Boolean expression bug514.c(7) : Info 774: Boolean within 'if' always evaluates to False [Reference: file bug514.c: line 7]
Reference Manual Explanation
514 Unusual use of a Boolean -- An argument to an arithmetic operator (+ - / * %) or a bit-wise logical operator (| & ^) was a Boolean. This can often happen by accident as in: if( flags & 4 == 0 ) where the ==, having higher precedence than &, is done first (to the puzzlement of the programmer).
If you have comments or questions about this bug, please post them to our Discussion Forum
Previous Bug - Bug #834 - March 2005