Re: Moving from C++ to VC++




"Doug Harrison [MVP]" <dsh@xxxxxxxx> skrev i meddelandet
news:1cpcoisgaqxnb.pzm9lwh4noqd.dlg@xxxxxxxxxxxxx
> On Mon, 13 Jun 2005 17:52:25 +0200, Bo Persson wrote:
>
>>>> Because now I have to use '__int64'?
>>>
>>> At least your code would then capture your requirement for the type.
>>
>> No it definitely does not!
>
> Let me see if I understand you. When one needs a 64 bit integer type,
> a 64
> bit integer type doesn't cut it. OK. Gotcha. No pleasing some people,
> I
> guess. :)

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

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. 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!

>
>> It only documents that we need a rather long integer.
>
> Actually, it states that in reality, you're using a 64 bit integer.
> When
> you use long, all you can say is that it's at least 32 bits and at
> least as
> large as int.

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. Something the implementor
would make big enough when the system changed.

>
>> What happens when
>> we move on to the next generation?
>
> For one thing, for the purposes of this thread, all the code that
> wrongly
> assumed long was 64 bits has to be modified.
>
>> Right, *some* of these will have to be changed into __int128. Which
>> ones? Nobody knows!
>
> That doesn't necessarily follow.

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


Bo Persson


.



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: 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)
  • Re: Moving from C++ to VC++
    ... > __int64 is a rather large integer, ... > bits will still be okay when we get machines with 96 or 128 or whatever ... We just get yet another long type problem! ... > Something to use when int just isn't enough. ...
    (microsoft.public.vc.language)