Re: Moving from C++ to VC++



On Mon, 13 Jun 2005 19:24:17 +0200, Bo Persson wrote:

> No, now you are making the assumptions. :-)

Rubber, meet glue. :)

> Using __int64 just means that int and long wasn't enough, because
> someone decided to keep them 32 bit, even when the machine grew. So now
> __int64 is a rather large integer, just like long once was. It doesn't
> say that I wanted exactly 64 bits.

Regardless of what you wanted, __int64 means exactly "64 bit integer". You
can't seriously think everyone who uses it would prefer a 4096 bit integer
if only it were available.

> It definitely doesn't say that 64
> bits will still be okay when we get machines with 96 or 128 or whatever
> bits. We just get yet another long type problem!

Sure, if you're using __int64 to mean the longest integer available, you'll
have that problem.

> But some of had expected the type long to be, like a kind of long type.
> Something to use when int just isn't enough.

The thing is, that's been an invalid assumption for the last 20 years of 32
bit machines.

> Something the implementor
> would make big enough when the system changed.

So you _do_ want to use it non-portably. Why not make your code more
predictable as well and acknowledge the data type decisions you think
you're avoiding by using long?

> So you expect __int64 to grow when we need an even larger index type?
> :-)

No, but I expect the code that used it for a 64 bit type to remain valid
much more so than if it had used long, and the size of long was changed.

--
Doug Harrison
Microsoft MVP - Visual C++
.



Relevant Pages

  • Re: function returning __int32 in place of __int64
    ... > number (assigned to a __int64 var). ... function returns an int, which is 32 bits on your platform. ... Then include "my_header.h" in all the source files. ... to be an int value, if it fits in an int, or a long value. ...
    (comp.dsp)
  • Re: C and only C language has a standard 64 bit integer type ?
    ... > a new keyword, it's a correction in the grammar. ... int16 is introduced and is an exact 16-bit type (of course additional ... int and short become equivalent of it. ... int64 is introduced and holds 64-bit values. ...
    (comp.lang.cpp)
  • Re: Proposal: New types in C++0x
    ... > is unsigned int16 to be the same as unsigned int and unsigned, ... > and unsigned int64 is the unsigned type. ... If, for example, there exists a platform that ... then replacing int's representation with a 16 bit representation would break ...
    (comp.lang.cpp)
  • Re: Moving from C++ to VC++
    ... >>> At least your code would then capture your requirement for the type. ... Using __int64 just means that int and long wasn't enough, ... We just get yet another long type problem! ...
    (microsoft.public.vc.language)
  • Re: Integer Dos And Donts
    ... While I hadn't really considered Integer being Int64 on 64 bit processors in ... does look like 2 Int32's will be packed nicely into an Int64, ... > Public Shared Sub Main ... > Of course if one really needs a platform specific Int, ...
    (microsoft.public.dotnet.languages.vb)

Loading