22-08-2006, 04:21 PM
MISRA-C meeting 22-8-2006
The array index sub-expression contains both unsigned and signed values (respectively) and is prohibited under rule 10.1.
The underlying type of a mixed signed / unsigned expression is undefined.
In your second example, the array index sub-expression is unsigned, and therefore the shift can be applied.
The array index sub-expression
Code:
var2 - 1
The underlying type of a mixed signed / unsigned expression is undefined.
In your second example, the array index sub-expression
Code:
var2 - 1U
Posted by and on behalf of the MISRA C Working Group