10-06-2008, 12:32 PM
The underlying type is uint8_t, which will be converted by the integer promotions to the type int. You can never assume that int is either signed or unsigned. As I see it, you must therefore always typecast to conform with MISRA:
mc2_1209_u8a = (uint8_t) -mc2_1209_u8a;
However, I believe that the following should also be compliant:
mc2_1209_u8a -= mc2_1209_u8a;
mc2_1209_u8a = (uint8_t) -mc2_1209_u8a;
However, I believe that the following should also be compliant:
mc2_1209_u8a -= mc2_1209_u8a;
<t></t>