Boost logo

Boost :

Subject: Re: [boost] [PREDEF] Review for the Boost.Predef library by Rene Riviera
From: Rene Rivera (grafikrobot_at_[hidden])
Date: 2012-02-18 16:01:49


On 2/18/2012 8:36 AM, Klaim - Joël Lamotte wrote:
> I guess it is ok to ask about details even if the library isn't in review
> yet, right?

Sure.. As it certainly won't prevent me from answering them ;-)

> I'm not an expert in architecture so I hope I'm not asking
> something obvious.
>
> My understanding is that for example if you're targeting classic PC
> hardware, you'll get
> BOOST_ARCHITECTURE_X86 for 32Bit OS
> BOOST_ARCHITECTURE_AMD64 for 64Bit OS (running on 64bit processor).

If you are targeting 64Bit you are more likely to get both
BOOST_ARCHITECTURE_AMD64 and BOOST_ARCHITECTURE_IA64.

> That assume that the hardware have a "normal" Intel or AMD processor.
> Then if it doesn't, it can be other kind of architecture (ARM or other
> listed in the defines)
>
> Would it be possible to also provide macros that would tell what is the
> "bit size" (I don't know the correct word here) without the architecture
> name?
> Something like
> BOOST_ARCHITECTURE_BITS_32
> BOOST_ARCHITECTURE_BITS_64

It is possible.. But the question of what size you are measuring comes
up first. The bit size could refer to pointer size, integer size, float
size, register size, or the "word" size. Which suggest that you would
want a more specific set of macros for the various measured types.
Ideally it would be better to base such macros on something natively
defined by the compiler.. As determining these from the
BOOST_ARCHITECTURE_* macros would be a bit a chore.

> Again, maybe I'm being naive about this, but I'm thinking about code that
> should behave differently under those conditions
> and shouldn't have to check all the corresponding architecture macro to
> detect wether it's 32 or 64 bits.

Not totally naive, and certainly a good abstraction idea.

> Anyway, it's a nice library that would allow me to not have to set some
> (certainly flawed) macro myself.

Thanks.

-- 
-- Grafik - Don't Assume Anything
-- Redshift Software, Inc. - http://redshift-software.com
-- rrivera/acm.org (msn) - grafik/redshift-software.com
-- 102708583/icq - grafikrobot/aim,yahoo,skype,efnet,gmail

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk