Why is this an issue?
This is a draft version of a MISRA C++ 202x rule proposed for public review.
MISRA Rule 9.6.1
Analysis Type: Decidable,Single Translation Unit
The use of
goto is usually regarded as bad programming practice as it can lead to code that is difficult to understand and analyse.
Restructuring code to avoid its use generally leads to code that has a lower level of complexity.
If this advice is not followed, M23_126: MISRA C++ 2023 Rule 9.6.3 ensure that the use of
goto does not result in code
that is considered to be unstructured.
Copyright The MISRA Consortium Limited © 2023
- S907 targets the same defect as this rule but for a non-mission-critical context.
- MISRA C++ 2023 Rule 9.6.2 - A
goto statement shall reference a label in a surrounding block
- M23_126: MISRA C++ 2023 Rule 9.6.3 - The
goto statement shall jump to a label declared later in the function body
External coding guidelines
C++ Core Guidelines ES.76: Avoid