MISRA C++:2008 Rule 6-2-3

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

Description

Rule Definition

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.

Polyspace Implementation

The checker considers a null statement as a line where the first character excluding comments is a semicolon. The checker flags situations where:

  • Comments appear before the semicolon.

    For instance:

    /* wait for pin */ ; 

  • Comments appear immediately after the semicolon without a white space in between.

    For instance:

    ;// wait for pin

The checker also shows a violation when a second statement appears on the same line following the null statement.

For instance:

; count++;

Troubleshooting

If you expect a rule violation but do not see it, refer to Coding Standard Violations Not Displayed.

Check Information

Group: Statements
Category: Required
Introduced in R2013b