Click on image to see enlargment
In Santa's new program to determine who was naughty and who was nice, good months are encoded with 'g' and bad months with 'b' and naughty is defined as two consecutive bad months. So why is the program not regarding Cheryl as being naughty?
bug774.c lint Output
--- Module: bug774.c (C) _ if( *p == 'b' && previous == 'b' ) naughty++; bug774.c(13) : Info 774: Boolean within 'if' always evaluates to False [Reference: file bug774.c: lines 11, 13]
Reference Manual Explanation
774 Boolean within 'String' always evaluates to [True/False] -- The indicated clause (String is one of if, while or for (2nd expression)) has an argument that appears to always evaluate to either 'True' or 'False' (as indicated in the message). Information is gleaned from a variety of sources including prior assignment statements and initializers. Compare this with message 506 which is based on testing constants or combinations of constants. Also compare with the Elective Note 944 which can sometimes provide more detailed information. See §9.2 Value Tracking
If you have comments or questions about this bug, please post them to our Discussion Forum
Previous Bug - Bug #662 - November 2006