5.5.4 Switch Statements

The compiler can encode switch statements using one of several strategies. By default, the compiler chooses a strategy based on the case values that are used inside the switch statement. Each switch statement is assigned its strategy independently.

The type of strategy can be indicated by using the #pragma switch directive (see 5.14.3.10 The #pragma Switch Directive), which also lists the available strategy types. There can be more than one strategy associated with each type.

There is information printed in the assembly list file for each switch statement detailing the value being switched and the case values listed (see 6.3.4 Switch Statement Information).

Case ranges (lo_value … hi_value:) are not a feature of the C90 or C99 standard and it is recommended that they are not used in programs. The compiler will correctly compile switch statements using case ranges; however, a warning will be issued for their use if the CCI is enabled.