MISRA C:2025 Rule 13.3
R2026bA 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
Since R2026b
Description
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 1 .
Rationale
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.
Troubleshooting
If you expect a rule violation but do not see it, refer to Diagnose Why Coding Standard Violations Do Not Appear as Expected.
Examples
Check Information
| Group: Side Effects |
| Category: Advisory |
| AGC Category: Disapplied |
PQL Name:
std.misra_c_2025.R13_3
|
Version History
Introduced in R2026b
1 All MISRA coding rules and directives are © Copyright The MISRA Consortium Limited 2021.
The MISRA coding standards referenced in the Polyspace® Bug Finder™ documentation are from the following MISRA standards:
MISRA C:2004
MISRA C:2012
MISRA C:2023
MISRA C:2025
MISRA C++:2008
MISRA C++:2023
MISRA and MISRA C are registered trademarks of The MISRA Consortium Limited 2021.