MISRA.SWITCH.BOOLCondition of switch statement is boolean expression. MISRA-C Rule 15.4 (required): A switch expression shall not represent a value that is effectively Boolean.See "Boolean expressions" in the glossary. Exampleswitch (x == 0) /* not compliant - effectively Boolean */ { ... MISRA-C++ Rule 6-4-7 (required): The condition of a switch statement shall not have bool type.RationaleAn if statement gives a clearer representation for a Boolean choice. Exampleswitch ( x == 0 ) // Non-compliant { ... } |