Reputation: 49
I am new to MISRA rules concepts. I have a rule 12.2 warning saying
The value of an expression shall be the same under any order of evaluation that the standard permits (MISRA C 2004)
on the following C code:
PtToStack->Entry[PtToStack->top] = e ;
where PtToStack
is pointer to stack, Entry
is array in the stack structure and top
variable is a field of the stack structure.
e
has the same type of Entry
.
Could any one help me to understand the warning?
Upvotes: 0
Views: 1928
Reputation: 213458
This rule from MISRA-C:2004 (older standard) is concerning the order of evaluation of operands, in expressions where the order is not specified. There are plenty of examples and education material regarding the issue, below rule 12.2.
In your expression, there are no issues with unspecified order of evaluation. Therefore, the warning is incorrectly generated by your tool. Your static analyser is bad, file a bug report with the tool vendor.
Upvotes: 1