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 */ } |