TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
ASML C Coding Standard
Search

Rule:  6.8.3.bChecked automatically with code checker

Synopsis:A null statement (;) shall not be used.
Language:C
Severity Level:6
Category:Statement and Blocks


Description:

Justification

Empty statements are probably a bug (forgetting parentheses when calling a function?). Since all selection and iteration statements should have a compound statement as the body, a null body should have a comment suitably indented.

The other use for a null statement is to carry a label before a closing brace, but since labels are prohibited by this standard so such null statements are, by implication, also prohibited.

Example

if (i == 0); /* WRONG */
if (i == 0)
{
   ; /* WRONG */
}

if (i == 0) /* RIGHT */
{
   /* suitable comment */
}