V2554. MISRA. Expression containing increment (++) or decrement (--) should not have other side effects.


This diagnostic rule is based on the software development guidelines developed by MISRA (Motor Industry Software Reliability Association).

Using a decrement (--) or increment (++) operation along with other operators in one expression is not recommended. Using them in an expression that has other side effects makes the code less readable and may result in undefined behavior. A safer practice is to isolate the decrement/increment operators in separate expressions.

Example of non-compliant code:

i = ++i + i--;

This code attempts to modify one variable at one sequence point, which results in undefined behavior.


Bugs Found

Checked Projects
363
Collected Errors
13 495