Subject: Re: long long vs long
From: [email-masked] (Matthew Donadio)

24 Jul 1998 00:29:17 -0700
Message-ID: <[email-masked]>
References: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
To: "Michael H. Warfield" <[email-masked]>
Cc: [email-masked]

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 ([email-masked]) | 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
"[email-masked]" with one line of text: "help".