long long vs long

Matthew Donadio donadio@isptechinc.com
Thu Jul 23 13:02:00 GMT 1998


Michael H. Warfield wrote:
> Unfortunately the standard also specifies the length of several
> types.  Specifically char is 8 bits, short is 16 bits, and long is 32 bits.

Not to be picky, but to quote K&R II pg. 36:

"Each compiler is free to choose appropriate sizes for its own hardware,
subject only to the restriction that shorts and ints are at least 16
bits, longs are at least 32 bits, and short is no longer than int, which
is no longer than long."

Also, chars are not limited to be only 8 bits, but they must be at least
8 bits.  I routinely work on processors (C40, C44) where CHAR_BIT is
32.  This results in the pecularity that 

	sizeof(char) = sizeof(long) = 1

which is perfectly legal.  I think there is a lot more code in the world
that asumes that CHAR_BIT is 8 than sizeof(long) is 4.

-- 
Matt Donadio (donadio@isptechinc.com) | 43 Leopard Rd, Suite 102
Sr. Software Engineer                 | Paoli, PA 19301-1552
Image & Signal Processing, Inc.       | Phone: +1 610 407 4391
http://www.isptechinc.com             | FAX:   +1 610 407 4405
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".



More information about the Cygwin mailing list