delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/07/24/23:08:58

From: donadio AT isptechinc DOT com (Matthew Donadio)
Subject: Re: long long vs long
24 Jul 1998 23:08:58 -0700 :
Message-ID: <35B8C883.3AD9.cygnus.gnu-win32@isptechinc.com>
References: <199807221508 DOT LAA12504 AT alcove DOT wittsend DOT com>
Mime-Version: 1.0
To: Timothy Writer <Tim DOT Writer AT ftlsol DOT com>
Cc: gnu-win32 AT cygnus DOT com

Timothy Writer wrote:
>     sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long)
> and
>     sizeof(char)  == 1
>     sizeof(short) >= 2
>     sizeof(int)   >= 2
>     sizeof(long)  >= 4

Not necessarilly.  By definition sizeof(char) is always 1 no matter what
CHAR_BIT is defined to be.  But the values for the other sizeof's are
not correct for all machines.

For example, on the TMS320C3x and TMS320C4x families, the minimum
addressable memory unit is 32 bits, so CHAR_BIT for this machine is 32. 
It also happens that all other intergral types (short, int, and long)
are 32 bits (the exact size of char), so

sizeof(char) == sizeof(short) == sizeof(int) == sizeof(long) == 1

Weird, but legal.

-- 
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