Skip to main content

IAR Embedded Workbench for RL78 5.20

MISRAC++2008-6-2-3

In this section:
Synopsis

(Required) Before preprocessing, a null statement shall only occur on a line by itself; it may be followed by a comment, provided that the first character following the null statement is a white-space character.

Enabled by default

No

Severity/Certainty

Low/Low

lowlow.png
Full description

There are stray semicolons on the same line as other code. This check is identical to EXP-stray-semicolon, MISRAC2004-14.3.

Coding standards
CERT EXP15-C

Do not place a semicolon on the same line as an if, for, or while statement

MISRA C:2004 14.3

(Required) Before preprocessing, a null statement shall only occur on a line by itself; it may be followed by a comment, provided that the first character following the null statement is a whitespace character.

Code examples

The following code example fails the check and will give a warning:

void example(void) {
  int i;
  for (i=0; i!=10; ++i);  //Null statement as the
                          //body of this for loop
}

The following code example passes the check and will not give a warning about this issue:

void example(void) {
  int i;
  for (i=0; i!=10; ++i){  //An empty block is much
  }                       //more readable
}