MISRA C++:2008 Rule 5-0-1
The value of an expression shall be the same under any order of evaluation that the standard permits
Description
Rule Definition
The value of an expression shall be the same under any order of evaluation that the standard permits.
Rationale
If an expression results in different values depending on the order of evaluation, its value becomes implementation-defined.
Polyspace Implementation
Polyspace® raises a violation if an expression satisfies any of these conditions:
The same variable is modified more than once in the expression or it is both read and written.
The expression allows more than one order of evaluation.
The expression contains a single
volatile
object that occurs multiple times.The expression contains more than one
volatile
object.
Because volatile
objects can change their value at
anytime, an expression containing multiple volatile
variables or
multiple instances of the same volatile
variable might have
different results depending on the order of evaluation.
Troubleshooting
If you expect a rule violation but Polyspace does not report it, see Diagnose Why Coding Standard Violations Do Not Appear as Expected.
Examples
Check Information
Group: Expressions |
Category: Required |