Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost-users Digest, Vol 1983, Issue 1
From: John Dlugosz (JDlugosz_at_[hidden])
Date: 2009-05-04 12:29:10


> Date: Fri, 01 May 2009 20:15:50 -0600
> From: tom fogal <tfogal_at_[hidden]>
> Subject: Re: [Boost-users] General C++: Class Method Signatures
> Miss-Match
> To: boost-users_at_[hidden]
> Message-ID: <auto-000019286349_at_[hidden]>
>
> Dominique Devienne <ddevienne_at_[hidden]> writes:
> > On Fri, May 1, 2009 at 10:32 AM, Dan Day <coolmandan_at_[hidden]>
> wrote:
> > > I thought that int represented the natural word size of the
> > > architecture. If so, then wouldn't unsigned int be 64-bit on a
> > > 64-bit platform as well?
>
> I had heard this before as well. I took a quick look through c1x-1336
> (current (?) draft of C) though, and I could not find anything to this
> effect.
>
> Of course, that doesn't say it's not there, and I did not check the
C++
> standard.
>
> > The few 64-bit platforms I've seen keep [unsigned] int at
> > 32-bits. --DD
>

What is "natural"? The AMD-x64 is built on top of the 32-bit
architecture. The instruction set (in 64-bit mode) uses 32 bits as the
nominal and default data size for most operations. Even for memory
addresses, it's a 32-bit relative-to-IP value.

It takes an opcode prefix to indicate the use of 64-bit values.
The memory architecture can handle 32-bit values without penalty, and
you fit more of them in the cache. So 32-bit ints are not at all
"unnatural".

In principle, using 32-bit ints for casual use instead of gratuitously
using 64-bits where you don't need the extra size will run faster. It
reduces the memory bandwidth for both data and code size, even though
the internal execution is the same speed in either case.

--John
(sorry about the footer; it's not my idea)

TradeStation Group, Inc. is a publicly-traded holding company (NASDAQ GS: TRAD) of three operating subsidiaries, TradeStation Securities, Inc. (Member NYSE, FINRA, SIPC and NFA), TradeStation Technologies, Inc., a trading software and subscription company, and TradeStation Europe Limited, a United Kingdom, FSA-authorized introducing brokerage firm. None of these companies provides trading or investment advice, recommendations or endorsements of any kind. The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net