On Tue, 31 Jan 2012, Chuck Guzis wrote:
Sort of. Are there any particular C rules saying that
types long,
int and char must be integral multiples of one another. For
instance, could one have a char of 16 bits, an int of 21 bits and a
long of 29 bits?
Absolutely.
In K&R C (I don't know from ANSI), it was recommended that an int be
whatever type was easiest to deal with.
A short int could be the same or smaller.
A long int could be the same or larger.
It was explicitly stated that the only given was that the sizeof long int
could not be SMALLER than the size of int, and the sizeof in could not be
smaller than the sizeof short int.
int and unsigned int are often the same size, but that was NOT required.