MISRA Discussion Forums
MISRA C++ 2008 Rule 6-1-1 Clarification - Printable Version

+- MISRA Discussion Forums (https://forum.misra.org.uk)
+-- Forum: MISRA C++ (https://forum.misra.org.uk/forumdisplay.php?fid=18)
+--- Forum: MISRA C++:2008 rules (https://forum.misra.org.uk/forumdisplay.php?fid=19)
+---- Forum: 6.6 Statements (C++) (https://forum.misra.org.uk/forumdisplay.php?fid=135)
+---- Thread: MISRA C++ 2008 Rule 6-1-1 Clarification (/showthread.php?tid=1739)



MISRA C++ 2008 Rule 6-1-1 Clarification - mshawa - 27-05-2025

Given the headline text of MISRA C++ 2008 Rule 6-1-1, MISRA C++ 2023 Rule 9.6.2 seems to be the equivalent rule in this case. MISRA C++ 2023 Rule 9.6.2 includes the following non-compliant example: 
Code:
switch(i)
{
    case 0:
      if(x < y)
        goto L3;            // Non-compliant
      break;

    case 1:
    L3:
      break;
}

This example seems to echo an amplification made in the MISRA C 2012 Rule 15.3 (that has the same headline text as MISRA C++ 2008 Rule 6-1-1), which states: 
  • Quote:For the purposes of this rule, a switch-clause that does not consist of a compound statement is treated as if it were a block.


It would be greatly appreciated if you could clarify whether the above example was also intended to violate MISRA C++ Rule 6-1-1.