|
![]() Click on image to see enlargment |
|
PC-lint/FlexeLint Output | Reference Manual Explanation | Home bug646.cpp
It's back to school time and the first grade teacher has initiated a program that will do arithmetic operations automatically. But to his amazement, "-35" is being converted to positive 35 and his compiler gave no warning. What's going on? bug646.cpp lint Output
--- Module: bug646.cpp (C++)
_
while( (ch = *++s) )
bug646.cpp(10) : Info 732: Loss of sign (assignment) (char to unsigned char)
bug646.cpp(10) : Info 820: Boolean test of a parenthesized assignment
_
if( !*s ) default:;
bug646.cpp(14) : Warning 616: control flows into case/default
bug646.cpp(14) : Info 825: control flows into case/default without -fallthrough comment
bug646.cpp(14) : Warning 646: case/default within while loop; may have been misplaced
Reference Manual Explanation
646 case/default within Kind loop; may have been misplaced -- A case or default
statement was found within a for, do, or while loop. Was this intentional?
At the very least, this reflects poor programming style.
CommentaryThis is definitely not one of those bugs that a programmer will typically run into, but it is an example of how an outlandish misplacement of a keyword (default) is accepted without a whimper as perfectly normal by most compilers. If you have comments or questions about this bug, please post them to our Discussion Forum |
Previous Bug - Bug #649 - August 2007