Click on image to see enlargment
Much to the chagrin of European bankers, Abraham Lincoln issued greenbacks to finance the Civil War. This program represents an early effort to detect counterfeit greenbacks. But something's going wrong. Can you spot it?
bug587.cpp lint Output
--- Module: bug587.cpp (C++) _ if( (serial & 0x2E537B4) == 0x2C42540 ) bug587.cpp(6) : Warning 587: Predicate '==' can be pre-determined and always evaluates to False _ } bug587.cpp(19) : Info 818: Pointer parameter 'argv' (line 12) could be declared as pointing to const
Reference Manual Explanation
587 Predicate 'String' can be pre-determined and always evaluates to String -- The predicate, identified by the first String, (one of greater than, greater than or equal, less than, less than or equal, equal, or not equal), cannot possibly be other than what is indicated by the second String parameter. For example: unsigned u; ... if( (u & 0x10) == 0x11 ) ... would be greeted with the message that '==' always evaluates to 'False'.
If you have comments or questions about this bug, please post them to our Discussion Forum
Previous Bug - Bug #1416 - January 2009