On Tue, 3 Jul 2012, Sean Conner wrote:
But sizeof(unsigned short) is *still* defined (same
section as above).
The ANSI C specification states that a short shall be *at least* 16 bits in
size, but can be larger, but must be shorter than a long.
NO!!!!
a short need not be shorter than a long! But it must not be LONGER than a
long. That is an important distinction in the limits on C's variable
sizes
"An int can't be shorter than a short, and can't be longer than a
long."
You COULD, with sufficient insanity, create a compiler wherein an int,
short-int, long-int are all 32 bit. or 64 bit.
I'd RATHER have them different. In small memory model, with an array of
400+ x 20 numbers, and a metric handful of static arrays to hold 80 x 25
text screens (2 x 8, or 16 bits per screen position), and a few 1024
arrays (to hold bytes), . . . Having some smaller sizes can be handy.
isn't ANSI C, then yes, it can be pretty much
anything, but ANSI does
specify a minimum length.
But NOT a maximum, NOR a requirement, although they have different lower
limits, that they have differne upper limits.
"An int can't be shorter than a short, and can't be longer than a
long."