This is the mail archive of the
cygwin@sourceware.cygnus.com
mailing list for the Cygwin project.
Re: long long vs long
- To: "Michael H. Warfield" <mhw at alcove dot wittsend dot com>
- Subject: Re: long long vs long
- From: Matthew Donadio <donadio at isptechinc dot com>
- Date: Thu, 23 Jul 1998 10:49:34 -0400
- CC: gnu-win32 at cygnus dot com
- References: <199807221508.LAA12504@alcove.wittsend.com>
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".