Re: Moving from C++ to VC++
- From: "Doug Harrison [MVP]" <dsh@xxxxxxxx>
- Date: Thu, 9 Jun 2005 10:23:58 -0500
On Thu, 9 Jun 2005 09:23:35 +0200, Hendrik Schober wrote:
> One would assume (that is, I would anyway) the
> native integer size on a 64bit platform to be
> 64bit. AFAIK, according to the C/C++ standards,
> even 'int' should be 64bit then. I agree that
> the usefulness of this is at least debatable.
> (Even though I would prefer 'int' to be the
> native integer type of the platform. If you need
> less than that, use 'short' or 'int32_t' or
> whatever.)
The main argument for int reflecting the "native" word size has been
efficiency. Anyone know how well these 64 bit CPUs implement 32 bit data
types?
> But I really don't see any excuse for not making
> 'long' 64bit on a 64bit platform.
Portable code can't assume long is larger than 32 bits. If you care about
anything beyond the minimum sizes, you have no business using the native
types. I know we all violated that with int and 32 bit platforms, but times
change. I can't remember the last time I wrote "long" on a 32 bit platform,
where I know int is 32 bits, and long is the same size. Well, that's not
entirely true. Like a lot of people, I assumed size_t would fit in an
unsigned long when using printf and friends and cast accordingly. That
assumption does fail in Win64, but hopefully the compiler will warn about
the possible (very rare) truncation.
--
Doug Harrison
Microsoft MVP - Visual C++
.
- Follow-Ups:
- Re: Moving from C++ to VC++
- From: Hendrik Schober
- Re: Moving from C++ to VC++
- From: Bo Persson
- Re: Moving from C++ to VC++
- References:
- Moving from C++ to VC++
- From: NoName
- Re: Moving from C++ to VC++
- From: Severian [MVP]
- Re: Moving from C++ to VC++
- From: Victor Bazarov
- Re: Moving from C++ to VC++
- From: Carl Daniel [VC++ MVP]
- Re: Moving from C++ to VC++
- From: Hendrik Schober
- Re: Moving from C++ to VC++
- From: Carl Daniel [VC++ MVP]
- Re: Moving from C++ to VC++
- From: Hendrik Schober
- Moving from C++ to VC++
- Prev by Date: Re: Stopping 'false' memory leak traces
- Next by Date: Re: Moving from C++ to VC++
- Previous by thread: Re: Moving from C++ to VC++
- Next by thread: Re: Moving from C++ to VC++
- Index(es):
Relevant Pages
|
Loading