Unsigned promotions

karl at haddock karl at haddock
Tue Aug 26 04:41:00 AEST 1986


When an unsigned char or unsigned short is used in an expression, is it
promoted to int or unsigned int?  (It is zero-extended either way, but the
type of the result is significant, e.g. in a divide.)

K&R seems not to mention unsigned datatypes other than int.
My local C compiler promotes it to unsigned.
X3J11 (May, 1986) says the result is int.

Do some existing compilers promote to signed int?  What does H&S say?

Karl W. Z. Heuer (karl at haddock.isc.com; ima!haddock!karl), The Walking Lint



More information about the Comp.lang.c mailing list