Name | Checked | Synopsis |
---|
7#1
|
 |
Expressions which either mix operators from the set >, >=, <, <=, ==, !=, with operators from the set <<, >>, ^, &, |, &&, || or which use two or more distinct operators from the latter set shall be fully parenthesised and make no use of the C precedence rules. |
7#2
|
 |
Expressions shall not contain multiple side-effects due either to the same identifier being modified more than once, or due to the same identifier being modified and accessed. |
7#3
|
 |
Expressions containing multiple function references should be avoided due to the possibility of side-effects occurring in an undefined order. |
7.2#1
|
 |
Void expressions have no value and must not be used in other expressions. |
7.2#2
|
 |
Constant expressions must not lead to division by zero. |
7.2#3
|
 |
The value of an incomplete 'union' must not be used. |
7.2#4
|
 |
The value of an incomplete 'struct' must not be used. |
7.3.4#1
|
 |
The increment and decrement operators should not be mixed with prefix forms in the same expression. |
7.4.5#1
|
 |
Unary minus shall not be applied to an unsigned expression. |
7.4.8#1
|
 |
sizeof shall not be applied to an expression with side-effects. |
7.4.8#2
|
 |
Wherever possible, use sizeof entity; rather than sizeof (type); |
7.5#1
|
 |
Expressions shall not be cast to the same type. |
7.5#2
|
 |
Explicit casting from and to any other type from void * is forbidden. |
7.5#3
|
 |
Avoid explicit casting where possible. |
7.8#1
|
|
The right operand of a shift operator in a constant expression must not be negative or imply too large a shift. |
7.8#2
|
 |
The left operand of a shift operator must not be signed. |
7.8#3
|
|
Left shifts in constant expressions shall not be such as to truncate any bits from the result. |
7.9#1
|
 |
The operands of relational operators should be parenthesised unless both are simple values, identifiers, or function calls. |
7.10#1
|
 |
Floating point expressions shall not be compared using either the == or != operators. |
7.10#2
|
 |
The operands of equality operators should be parenthesised unless both are simple values, identifiers, or function calls. |
7.14#1
|
 |
The right-hand operand of the logical AND operator shall not contain any side-effects because it is conditionally executed. |
7.14#2
|
 |
The operands of logical AND should be parenthesised unless both are simple values, identifiers, or function calls. |
7.15#1
|
 |
The right-hand operand of the logical OR operator shall not contain any side-effects because it is conditionally executed. |
7.15#2
|
 |
The operands of logical OR shall be parenthesised unless both are simple values, identifiers, or function calls. |
7.16#1
|
 |
The second and third operands of the conditional operator shall not contain side-effects because they are conditionally executed. |
7.16#2
|
 |
Use parentheses to improve readability of the conditional operator. |
7.16#3
|
 |
The convenience of the conditional operator should be weighed against the clarity of the code. |
7.18#1
|
 |
The comma operator must be used only within a for statement or within macros. |
7.18#2
|
 |
In general, the comma operator should be avoided. |
7.19#1
|
|
Arithmetic operations on constant expressions must not lead to wrapround |