Re: Is __int64 dead?
- From: "Doug Harrison [MVP]" <dsh@xxxxxxxx>
- Date: Mon, 27 Aug 2007 10:37:43 -0500
On Mon, 27 Aug 2007 12:35:14 +0100, Daniel James
<wastebasket@xxxxxxxxxxxxxxxx> wrote:
If you use long long that's one reserved word (used twice), if you use
longlong you're adding a whole new reserved word to the language ... which
is generally regarded as a bad idea. Doubling up the long keyword is
simple, easy to understand, and has been around as an idea for almost forty
years (since Algol-68).
I never liked the idea of codifying a classic typo...
I just wish it was arbitrarily extensible ... if I actually wanted a
1024-bit integer I would really like to be able to write long long long
long long long int and have the compiler generate the right code to handle
it (optimally and efficiently).
I think it would be a lot better to use int<1024> or something like that. I
mean, do you really want to be asking yourself what the difference is
between "long long long long int" and "long long long long long int"?
Note also that while the compiler can implement native types efficiently,
it probably can't do much better than existing bignum libraries for
arbitrary precision. The main advantage I see to having the compiler do it
is defining a standard syntax for it.
And INT_PTR so called because it is the size of a pointer... I mean that
makes sense to the people who designed it, but not the users of it.
It makes very little sense to anyone on an architecture on which pointers
to different types of things have different sizes.
Well, all pointers are convertible to void*, so make INT_PTR an integer
type large enough to hold a void*, and you're done. (Of course, you need
such an integer type, and in the Windows LLP64 model, the compiler needs to
implement "long long", else it lacks a fundamental type for this or even to
implement size_t. I don't know what the 64-bit VC does... It probably
dodges the size_t issue by making it a native type, which is what the
32-bit VC does, and it may use __int64 for INT_PTR, which is fine.)
--
Doug Harrison
Visual C++ MVP
.
- Follow-Ups:
- Re: Is __int64 dead?
- From: Joseph M . Newcomer
- Re: Is __int64 dead?
- References:
- Is __int64 dead?
- From: xmllmx
- Re: Is __int64 dead?
- From: Joseph M . Newcomer
- Re: Is __int64 dead?
- From: David Webber
- Re: Is __int64 dead?
- From: David Ching
- Re: Is __int64 dead?
- From: Daniel James
- Is __int64 dead?
- Prev by Date: Re: mfc ext dll from path
- Next by Date: Re: EndDialog hangs on Core2Duo system
- Previous by thread: Re: Is __int64 dead?
- Next by thread: Re: Is __int64 dead?
- Index(es):
Relevant Pages
|