12-12-2013, 09:06 AM
The first two paragraphs of the answer given by Steve Montgomery have given a good summary of why shifting on signed integers can give problems.
Any shift on a signed integer will violate rule 12.7, because of the implementation defined behaviour of such shifts.
Any shift on a signed integer will violate rule 12.7, because of the implementation defined behaviour of such shifts.
Posted by and on behalf of the MISRA C Working Group