Re: Length of data types for _WIN64
From: Joseph M. Newcomer (newcomer_at_flounder.com)
Date: 03/09/04
- Next message: Cathy Milan: "Re: Enable users to modify Protected Registry Keys"
- Previous message: Alec S.: "Re: CFileDialog for path only selection?"
- In reply to: TT \(Tom Tempelaere\): "Re: Length of data types for _WIN64"
- Next in thread: josh: "Re: Length of data types for _WIN64"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 08 Mar 2004 22:09:07 -0500
char - 8 bits, 1 byte
short - 16 bits, 2 bytes
int, long - 32 bits, 4 bytes
long long - 64 bits, 8 bytes
void * - 64 bites, 8 bytes
They avoided the C stupidity of making "int" be platform-dependent. This was a mistake in
the design of C (which I had to deal with in porting PDP-11 code to the Vax in the early
1980s, and I said it was a mistake then, and it still is).
The ISO C standard defines limits.h to be
SCHAR_MIN -127
SCHAR_MAX 127
UCHAR_MAX 255
SHRT_MIN -32767
SHRT_MAX -32767
USHRT_MAX 65535
INT_MIN -32767
INT_MAX 32767
UINT_MAX 65535
LONG_MIN -2147483647
LONG_MAX 2147483647
ULONG_MAX 4294967295
and says that any implementation can "substitute other values for these but they must not
be less in absolute magnitude than the values shown, and must have the same sign".
[the table and quote come from Harbison & Steele, 4th edition, p.112].
Note the anomaly in the spec, in that SCHAR_MIN is -127, not -128, for example. So this
pretty much establishes the minimum sizes for the types, in bits. The ISO standard allows
int to be 16 bits, but a 32-bit implementation is free to define this to be a 32-bit
range.
Sam Harbison once worked on a compiler where sizeof(char) == sizeof(short) == sizeof(int)
== sizeof(long) == sizeof(long long) == 1, and SCHAR_MIN was a number which was somehting
like -2**80-1 (it was an 80-bit-word DSP chip).
joe
On Mon, 08 Mar 2004 19:34:19 GMT, "TT \(Tom Tempelaere\)"
<_N_OSPAMtiti____@hotmail.comMAPSO_N_> wrote:
>"David Lowndes" <davidl@example.invalid> wrote in message
>news:8vlo409dmkg4vgm0g68k6rmjqr86q47ev2@4ax.com...
>> >What lenghts are the primitive data types if _WIN64 is defined?
>>
>> Tom,
>>
>> Have a look at the topic titled "The New Data Types" in MSDN.
>>
>> Dave
>> --
>> MVP VC++ FAQ: http://www.mvps.org/vcfaq
>
>Ok, but they only mention the defined types, not primitve.
>
>I was talking about: short, int, long, long long.
>---
>Cheers,
>Tom Tempelaere
>
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
- Next message: Cathy Milan: "Re: Enable users to modify Protected Registry Keys"
- Previous message: Alec S.: "Re: CFileDialog for path only selection?"
- In reply to: TT \(Tom Tempelaere\): "Re: Length of data types for _WIN64"
- Next in thread: josh: "Re: Length of data types for _WIN64"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|