When a switch statement is used on a variable of an enumeration type, all values of that enum should be covered by the switch statement; either by explicitly listing all values, or by using a default label.
If no action is required for the default case, a comment such as 'no action' is recommended. If the default case should be unreachable, an assertion to this effect is recommended.
Furthermore, if a default label is used, it should always be used on the last section. This ensures the default label is easy to locate. This requirement applies to all switch switch statements, including those that are used on variables of non-enum types. |