Name | Checked | Synopsis |
---|
9.1#1
|
 |
Statements must not be labelled. |
9.1#2
|
 |
Only a conventional case .. default construct may follow a switch statement. |
9.1#3
|
 |
A label should be on a separate line |
9.2#1
|
 |
A statement must have a side-effect, i.e., it must do something. |
9.2#2
|
 |
A null statement, if used, shall appear on a line by itself. |
9.4#1
|
 |
Controlling expressions shall not contain assignments. |
9.4#2
|
 |
To clarify the actual test performed in a selection statement, there should be an explicit comparison operator unless the compared object is of effectively 'Boolean' type. |
9.4.1#1
|
 |
Multiple choice constructs programmed using if ... else if ... shall have a "catch-all" clause. |
9.4.1#2
|
 |
The else and if should appear with the else indented to match the if above. |
9.4.1#5
|
 |
An if statement must be followed by a {..} construct even when only one statement, (null (;) or otherwise) is used. |
9.4.1#6
|
 |
An if statement must not lead to a degenerate comparison, for example the comparison of an unsigned quantity against a negative-valued constant. |
9.4.2#1
|
 |
All switch statements shall have a default clause, even if that clause is empty. |
9.4.2#2
|
 |
Each case clause and default clause shall be terminated by a break statement unless empty. |
9.4.2#3
|
 |
The default clause should be the last entry in the switch statement. |
9.4.2#5
|
 |
The switch expression shall not contain the ">", ">=", "<", "<=", "==", "!=", "&&", "||" or "!" operators. |
9.4.2#6
|
 |
The switch expression shall contain at least one case label. |
9.5#1
|
 |
To clarify the actual test performed in an iteration statement, there should be an explicit comparison operator. |
9.5.1#1
|
 |
A while statement must be followed by a {..} construct. |
9.5.2#1
|
 |
A for statement must be followed by a {..} construct even if only one statement is used. |
9.5.2#2
|
 |
The use of floating point variables as loop variables is forbidden. |
9.5.2#3
|
 |
A control variable shall not be altered by the body of a for statement. |
9.5.2#4
|
 |
Only loop control variable expressions should appear in the for statement. |
9.5.2#5
|
 |
Use a "for" loop construction for an infinite loop. |
9.6.1#1
|
 |
The break statement should not be used to exit from an iteration statement, (for or while). |
9.6.2#1
|
 |
The continue statement shall not be used. |
9.6.3#1
|
 |
The address of an object of automatic storage shall not be returned. |
9.6.3#2
|
 |
There should only be one return statement in a function returning non-void and this should appear at the bottom of the function. There should be no return statement in a function returning void. |
9.7#1
|
 |
The goto statement is unstructured and shall not be used. |