Synopsis: | Do not access a modified object more than once in an expression |
Language: | C++ |
Severity Level: | 1 |
Category: | Control Flow |
Description: |
The evaluation order of sub-expressions within an expression is undefined. See also [POR#029]. Example: v[i] = ++c; // right v[i] = ++i; // wrong: is v[i] or v[++i] being assigned to? i = i + 1; // right i = ++i + 1; // wrong: i is modified twice in an expression |