This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: long long vs long


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@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".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]