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

SR:  9.4.1#5Checked automatically with code checker

This rule is Obsolete
Synopsis:An if statement must be followed by a {..} construct even when only one statement, (null (;) or otherwise) is used.
Language:C
Severity Level:6
Category:STATEMENTS


Description:
If only indentation is used to indicate that a single statement belongs to an if, it is a frequently occurring mistake to enhance this construct by adding another statement without supplying the now necessary {..} to indicate that both statements belong to the if. The practice of using {..} also aids readability.

Example:

if ( ... )
    ; /* WRONG, no {} */
if ( ... )
{
    /* EMPTY*/ /* RIGHT */
}