TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
C++ Coding Standard
Search

Rule:  CFL#001Checked automatically with code checker

Synopsis:Statements following a case label shall be terminated by a statement that exits the switch statement
Language:C++
Severity Level:2
Category:Control Flow


Description:

If the code which follows a case label is not terminated by break, the execution continues after the next case label. A missing break statement can easily be overlooked resulting in erroneous code. Usually a break will be used to exit the switch statement. Be careful when using a return to exit the switch statement as in the example of ISC++: see [CFL#020].

Note that it is allowed to 'fall through' case labels: see [CFL#002].



Literature References:
Ellemtel Rule 47
ISC++ Rec 4.4