Peter Nilsson said:
You'll find there's no shortage of implementations where
unsigned short promotes to unsigned int, not int.
ANSI X.3-1989
3.2.1.1 Characters and Integers
A char, a short int, or an int bit-field, or their signed or
unsigned varieties, or an enumeration type, may be used
in any expression whereaever an int or unsigned int may be
used. If an int can represent all values of the original type,
type value is converted to an int; otherwise it is converted
to an unsigned int. These are called the integral promotions.
All other arithmetic types are unchanged by the integral
promotions.
The integral promotions preserve value including sign. As
discussed earlier, whether a "plain" char is treated as signed
is implementation-defined.
Hence, implementations can only promote unsigned short to unsigned
int if the signed int cannot hold all the values of the unsigned
short -- which is to say, implementations on which unsigned short
and unsigned int are the same size. On implementations on which
int has more value bits than unsigned short does, the promotion
must be to signed int, not to unsigned int.
The only implementations I can think of in which unsigned int
and unsigned short are the same size, are ones that have 16 bit
int -- that or they are DSPs that use the same large size for
short and int and long. Are those the implementations you
were thinking of in your "no shortage" statement?