MISRAC++2023-9.6.1
In this section:
Synopsis
(Advisory) The goto statement should not be used
Enabled by default
No
Severity/Certainty
Low/Medium

Full description
Use of the goto statement found. This check is identical to MISRAC2004-14.4, MISRAC2012-Rule-15.1.
Coding standards
- MISRA C:2004 14.4
(Required) The goto statement shall not be used.
- MISRA C:2012 Rule-15.1
(Advisory) The goto statement should not be used
Code examples
The following code example fails the check and will give a warning:
int example(void) {
goto testin;
testin:
return 42; /* Reached by goto */
}
The following code example passes the check and will not give a warning about this issue:
int example(void) {
return 42; /* Not reached by goto" */
}