Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 15.3, switch's, and "fallthru"
#2
Rule 15.3 is described in terms of switch-clause, which is defined in the amplification of rule 16.1.
As the questioner stated, the above example breaks several rules (e.g. 16.1, 16.3 and 15.6).

The Working group feels that in this example the code between "case 2 and break" should be considered as a switch-clause, but not the code between "case 1 and break". Therefore according to the amplification the code between "case 2 and break" should be treated as if it were a block. The goto would therefore be a jump into a block, which would violate rule 15.3.
Posted by and on behalf of the MISRA C Working Group
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)