This rule is Obsolete | |
Synopsis: | Braces ("{}") which enclose a block are to be placed in the same column, on separate lines directly before and after the block |
Language: | C++ |
Severity Level: | 10 |
Category: | Style |
Description: |
This way the beginning and the end of the block can easily be determined. Exception: This rule does not apply when braces are used in namespaces. do statementExample do statement: for statementdo { <statement> } while (expression); Example for statement: for (nCount = 0; nCount < Max(); ++nCount) { <statement> } if statement Example if statement without else statement: if (expression) { <statement> } Example if statement with else statement: if (expression) { <statement> } else { <statement> } Example if statement with else-if statement: if (expression) { <statement> } else if (expression) { <statement> } else { <statement> } switch statement
Example switch statement: switch (expression) { case <const-expression>: <statement> break; case <const-expression>: <statement> break; default: <statement> break; } try-catch statement
Example try-catch statement: try { <statement> } catch ( while statement Example while statement: while (expression) { <statement> } namespaces Example: namespace Philips { ... namespace Ixr { ... namespace IP { ... }}} |
Literature References: |
Ellemtel Rec. 24 |