>
>
>
V2502. MISRA. The 'goto' statement shou…


V2502. MISRA. The 'goto' statement should not be used.

This diagnostic rule is based on the software development guidelines developed by MISRA (Motor Industry Software Reliability Association).

This diagnostic rule is relevant only to C-programs. The use of 'goto' statements could mar the program structure and obscure the code. This diagnostic detects code fragments that use 'goto' statements.

Here is an example of code triggering this warning:

int foo(int value)
{
  ....
  if (value==0)
    goto bad_arg;
  ....
  return OK;
bad_arg:
  return BAD_ARG;
}

This diagnostic is classified as:

  • MISRA-C-15.1