|
- MISRA C:2012 Rule 2. 2 - A project shall not contain dead code - MathWorks
If an operation is reachable but removing the operation does not affect program behavior, the operation constitutes dead code The presence of dead code can indicate an error in the program logic Because a compiler can remove dead code, its presence can cause confusion for code reviewers
- Code review MISRA 2012 rules - IBM
The result of an assignment operator should not be used Boolean expressions should not contain assignment operators Advisory M13 4 2 The result of an assignment operator should not be used in an expression M13 5 Rule 13 5 Undecidable
- Rule 2. 2 - dead code - MISRA C
Rule 2 2 applies to operators not statements It is not a question of whether a whole statement is dead code, but whether there is an operation within the expression that has no effect on the program behaviour
- c - How to fix Misra 2012 violation , Assignment operation in . . .
The rule 13 4 is what applies here, stating that you aren't allowed to mix assignment with other expressions (the result of an assignment operation should not be used) From what we can tell from the code posted, you aren't doing that
- The result of an assignment operator should not be used
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 If you expect a rule violation but do not see it, refer to Diagnose Why Coding Standard Violations Do Not Appear as Expected
- c - MISRA 2012 Rule 2. 2 The result of this logical . . . - Stack Overflow
In particular, if (pol == NON_INV) is evaluated, we know that (pol == RISING) is false But RISING and INV are both defined to be zero, so (pol == NON_INV) and (pol == RISING) are each equivalent to (pol == 0)
|
|
|