AutosarC++17_10-M6.4.7¶
The condition of a switch statement shall not have bool type
Required inputs: IR
| Level | required |
|---|---|
| Target | implementation |
| Enforcement | automated |
Rationale
An if statement gives a clearer representation for a Boolean choice.
Example
switch ( x == 0 ) // Non-compliant
{
...
}
Note
For legal reasons, this rule’s description is not part of the public documentation.