Main Content
MISRA C:2023 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
Since R2024a
Description
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 |
Version History
Introduced in R2024a