03-02-2020, 01:53 PM
Appendix D.7 gives the essential type of an Shift Expression. It says:
There would have been a violation of rule 10.6 if the code had been written as
[code] 1U
Quote: Shift( > )In this case 1.2 applies and essential type is that of the left hand operand. The essential type of the left hand operand is uint32_t. There is therefore no assignment to a wider essential type and no violation of rule 10.6.
1. If the left hand operand is essentially unsigned then:
1.1 If both operands are integer constant expressions then the essential type of the result is the UTLR of the result;
1.2 Else the essential type of the result is the essential type of the left hand operand
There would have been a violation of rule 10.6 if the code had been written as
[code] 1U
Posted by and on behalf of the MISRA C Working Group