Main Content
MISRA C:2012 Rule 15.3
Any label referenced by a goto statement shall be declared in the same block, or in any block enclosing the goto statement
Description
Note
Using Code Prover for checking coding rules is no longer supported. See Version History.
Rule Definition
Any label referenced by a goto statement shall be declared in the same block, or in any block enclosing the goto statement.
Rationale
Unrestricted use of goto
statements makes
the program unstructured and difficult to understand. Restricting
use of goto
statements to jump between blocks or
into nested blocks reduces visual code complexity.
Troubleshooting
If you expect a rule violation but do not see it, refer to Diagnose Why Coding Standard Violations Do Not Appear as Expected.
Examples
Check Information
Group: Control Flow |
Category: Required |
AGC Category: Advisory |