Synopsis: | The switch expression shall not contain the ">", ">=", "<", "<=", "==", "!=", "&&", "||" or "!" operators. |
Language: | C |
Severity Level: | 5 |
Category: | STATEMENTS |
Description: |
Using relational or logical conjunctive operators in a switch expression is very
likely to be wrong and is at best confusing.
Example: switch( a > b ) /* WRONG */ { case ´b´: case ´c´: j = 4; break; } Example: switch( a ) /* RIGHT */ { case ´b´: case ´c´: j = 4; break; } |