Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
10.1 violated
#2
The value of the case expression is implicitly converted to the type of the switch chooser ( C90 section 6.6.4.2). This implicit conversion is checked by rule 10.1.

The type of the switch chooser (gus32cmd) is not given in this example, but must be either signed or unsigned. If gus32cmd is signed, then "case NUM" will violate rule 10.1 as they have different signs. If gus32cmd is unsigned, then "case NUM2" will violate rule 10.1 as again the signs are different.
Posted by and on behalf of the MISRA C Working Group
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)