[previous] MISRA-C:2004  Rule  14.3:  (Required) [next] 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.
Null statements should not normally be deliberately included, but where they are used they shall appear on a line by themselves. White-space characters may precede the null statement to preserve indentation. If a comment follows the null statement then at least one white-space character shall separate the null statement from the comment. The use of a white-space character to separate the null statement from any following comment is required on the grounds that it provides an important visual cue to reviewers. Following this rule enables a static checking tool to warn of null statements appearing on a line with other text, which would normally indicate a programming error. For example:

while ( ( port & 0x80 ) == 0 )
{
    ; /* wait for pin - Compliant */
    /* wait for pin */ ; /* Not compliant, comment before ; */
    ;/* wait for pin - Not compliant, no white-space char after ; */
}


QAC messages that encompass this guideline:

3138 Null statement is located close to other code or comments.



(c) The Motor Industry Research Association, 2004
QA C Source Code Analyser 8.1.2
MISRA-C:2004 Compliance Module 3.2
© 2013 Programming Research
www.programmingresearch.com
Personality Groups | Glossary | Message Index | MISRA-C:2004 Rule Index Contents