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

SR:  9.4.2#6Checked automatically with code checker

Synopsis:The switch expression shall contain at least one case label.
Language:C
Severity Level:7
Category:STATEMENTS


Description:
Without case labels there can only be one path through the 'switch' statement (that of the 'default' - which will be everything)

Example:

switch (...)
{
default:
...
}

The 'switch' statement can be discarded leaving the switch statement contents as inline code.

If there is no 'default' label either, then any statements within the body of the 'switch' statement will never be executed.