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

Rule:  6.8.4.2.dChecked automatically with code checker

Synopsis:The default clause shall be the last entry in the switch statement.
Language:C
Severity Level:5
Category:Statement and Blocks


Description:

Justification

In the interest of readability.

Example 1

switch (option)
{ 
default: /* WRONG */
   /* any statement */
   break;
case 1:
   /* any statement */
   break;
}

Example 2

switch (option)
{ 
case 1: /* RIGHT */
   /* any statement */
   break;
default:
   /* any statement */
   break;
}