Main Content
MISRA C:2012 Rule 13.4
The result of an assignment operator should not be used
Description
Rule Definition
The result of an assignment operator should not be used.
Rationale
The rule is violated if the following happens in the same expression:
The assignment operator acts on a variable.
Another read or operation is performed on the result of the assignment.
For example, the expression a[x]=a[x=y];
violates
this rule. The []
operator acts on the result of the assignment
x=y
.
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: Advisory |