[Courses] [C] Beginner's Lesson 4B: Arrays, Qualifiers, and Reading Numbers

Malcolm-Rannirl rannirl-lc at otherkin.net
Tue Oct 15 12:15:33 EST 2002


On Tuesday 15 October 2002 08:09 am, Lorne Gutz wrote:

> Note:  a short is always 16 bits and a long is 32 bits but
>        an int can be either 16 or 32.......maybe even 64 on
> some of the larger computers.

Not entirely true. A short is *at least* 16 bits and a long *at least* 32.
Longs are always at least the size of an int (so you can't have a 64 bit int 
and a 32 bit long, which the above suggests is possible). So you could have a 
short that is 32 bits on a 64 bit processor (or on a 32 bit one, but that's 
unlikely).

At least according to the C++ book, though I don't think that's an 
incompatibility with C (I just don't have the C reference on my desk).
(I seem to remember a 8bit short/16bit long machine, but that could have been 
with a pre-ANSI compiler).

-- 
"Don't think you are, know you are"
- Morpheus, 'the Matrix'



More information about the Courses mailing list