3 ms·
In the examples from the quiz the most tricky promotions IMO are that unsigned shorts are promoted to signed int instead of unsigned int, as signed and unsigned
by afiori 4y ago
In the examples from the quiz the most tricky promotions IMO are that unsigned shorts are promoted to signed int instead of unsigned int, as signed and unsigned have very different behaviors.
- WalterBright 4y agoBack before the 1989 C Standard, there was a huge debate about whether to do "value preserving" versus "sign preserving" integer promotions. About half the C compilers did the former, half the latter. Compromise wasn't possible. Value preserving won. And hence unsigned shorts are promoted to signed ints.