In the following discussion, it is assumed that uint16_t is an unsigned integer type of size 16 bits and to make the discussion easier it is assumed that "unsigned short" is also 16 bits.
Appendix D.6 shows that 556U and 420U are given the essential type
of essentially unsigned short
Appendix D.7 for + on essentially unsigned types says:
Code: Select all
Operations subject to the usual arithmetic conversions( * / % + - & | ^ )
2. Else if the operands are both essentially unsigned then:
2.1 If the expression is an integer constant expression then the
essential type of the result is the UTLR of the result;
Therefore the essential type
of "556U + 420U" is that of "essentially unsigned short"
since 976 fits within a 16-bit short.
There are no violations of rule 10.3 as all three assignments are from "essentially unsigned short"
to "essentially unsigned short"