A full expression containing an increment (++) or decrement (--) operator should have no other potential side effects other than that caused by the increment or decrement operator
A full expression containing an increment (++) or decrement (--) operator should have no other potential side effects other than that caused by the increment or decrement operator.
The rule is violated if the following happens in the same line of code:
The increment or decrement operator acts on a variable.
Another read or write operation is performed on the variable.
For example, the line y=x++ violates
this rule. The ++ and = operator
both act on x.
Although the operator precedence rules determine the order of
evaluation, placing the ++ and another operator
in the same line can reduce the readability of the code.
If you expect a rule violation but do not see it, refer to Coding Standard Violations Not Displayed.
| Group: Side Effects |
| Category: Advisory |
| AGC Category: Readability |