The right hand operand of a logical && or || operator shall not contain persistent side effects
The right hand operand of a logical && or || operator shall not contain persistent side effects.
The right operand of an || operator is not
evaluated if the left operand is true. The right operand of an && operator
is not evaluated if the left operand is false. In these cases, if
the right operand modifies the value of a variable, the modification
does not take place. Following the operation, if you expect a modified
value of the variable, the modification might not always happen.
For this rule, Polyspace® considers that a function call does not have a persistent side effect if the function body is not present in the same file as the function call.
If a call to a pure function is flagged, before ignoring this rule
violation, make sure that the function has no side effects. For instance,
floating-point functions such as abs() seem to only
return a value and have no other side effect. However, these functions make
use of the FPU Register Stack and can have side-effects in certain
architectures, for instance, certain Intel® architectures.
If the right operand is a volatile variable, Polyspace does not flag this as a rule violation.
The right hand operand of a && operator shall not contain side effects. The right hand operand of a || operator shall not contain side effects.
If you expect a rule violation but do not see it, refer to Coding Standard Violations Not Displayed.
| Group: Side Effects |
| Category: Required |
| AGC Category: Required |