Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The examples here fall under the exception MSC18MSC17:EX2 in MSC18 MSC17-C. Finish every set of statements associated with a case label with a break statement.

Noncompliant Code Example

...

Recommendation

Severity

Likelihood

Remediation Cost

Priority

Level

MSC20-C

medium

probable

medium

P8

L2

Other Languages

This rule appears in the C++ Secure Coding Standard as MSC21-CPP. Do not use a switch statement to transfer control into a complex block.

References

Wiki Markup
\[[ISO/IEC 9899:1999|AA. C References#ISO/IEC 9899-1999]\] Section 6.8.6.1 "The goto statement"
[MISRA 04|AA. C References#ISO/MISRA 04] Rule 15.1
[Tom Duff on Duff's Device|http://www.lysator.liu.se/c/duffs-device.html]