This diagnostic rule is based on the software development guidelines developed by AUTOSAR (AUTomotive Open System ARchitecture).
Using the assignment operation in subexpressions introduces an additional side effect making the code less readable and more susceptible to new mistakes.
Besides, following this rule significantly reduces the risk of confusing the operators '=' and '=='.
Example of non-compliant code:
int Inc(int i)
{
return i += 1; // <=
}
void neg(int a, int b)
{
int c = a = b; // <=
Inc(a = 1); // <=
if(a = b) {} // <=
}
This diagnostic rule is classified as:
|
Was this page helpful?
Your message has been sent. We will email you at
If you do not see the email in your inbox, please check if it is filtered to one of the following folders: