delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/07/24/00:29:17

From: donadio AT isptechinc DOT com (Matthew Donadio)
Subject: Re: long long vs long
24 Jul 1998 00:29:17 -0700 :
Message-ID: <35B74D7E.5FB2.cygnus.gnu-win32@isptechinc.com>
References: <199807221508 DOT LAA12504 AT alcove DOT wittsend DOT com>
Mime-Version: 1.0
To: "Michael H. Warfield" <mhw AT alcove DOT wittsend DOT com>
Cc: gnu-win32 AT cygnus DOT 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 AT isptechinc DOT 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 AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019