MISRA.GOTO.AFTER_LABEL.2012Goto jumps to label declared before in same function.
MISRA C 2012 Rule 15.2: The goto statement shall jump to a label declared later in the same functionCategory: Required Analysis: Decidable, Single Translation Unit Applies to: C90, C99 RationaleUnconstrained use of goto can lead to programs that are unstructured and extremely difficult to understand. Restricting the use of goto so that “back” jumps are prohibited ensures that iteration only occurs if the iteration statements provided by the language are used, helping to minimize visual code complexity. Examplevoid f ( void ) { int32_t j = 0; L1: ++j; if ( 10 == j ) { goto L2; /* Compliant */ } goto L1; /* Non-compliant */ L2 : ++j; } |