|
![]() Click on image to see enlargment |
|
PC-lint/FlexeLint Output | Reference Manual Explanation | Home bug616.cpp
This C/C++ program is an attempt to portray the beautiful sounds of spring but instead we obtain a cacophony. What went wrong? bug616.cpp lint Output
--- Module: bug616.cpp (C++)
_
case flower:
bug616.cpp(10) : Warning 616: control flows into case/default
bug616.cpp(10) : Info 825: control flows into case/default without -fallthrough
comment
_
case baseball:
bug616.cpp(12) : Warning 616: control flows into case/default
bug616.cpp(12) : Info 825: control flows into case/default without -fallthrough
comment
_
case golf:
bug616.cpp(14) : Warning 616: control flows into case/default
bug616.cpp(14) : Info 825: control flows into case/default without -fallthrough
comment
_
default: return;
bug616.cpp(16) : Warning 616: control flows into case/default
bug616.cpp(16) : Info 825: control flows into case/default without -fallthrough
comment
_
printf( "\n" );
bug616.cpp(18) : Warning 527: Unreachable code at token 'printf'
Reference Manual Explanation
616 control flows into case/default -- It is possible for flow of
control to fall into a case statement or a default statement from
above. Was this deliberate or did the programmer forget to
insert a break statement? If this was deliberate then place a
comment immediately before the statement that was flagged as in:
case 'a': a = 0;
/* fall through */
case 'b': a++;
Note that the message will not be given for a case that merely
follows another case without an intervening statement. Also,
there must actually be a possibility for flow to occur from
above.
If you have comments or questions about this bug, please post them to our Discussion Forum |
Previous Bug - Bug #866 - March 2010