|
Boost : |
Subject: Re: [boost] [predef] BOOST_ARCH_BITS_* feature request
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2015-09-16 18:54:08
On Wed, Sep 16, 2015 at 11:49 PM, Bjorn Reese <breese_at_[hidden]> wrote:
> On 09/16/2015 09:15 PM, Antony Polukhin wrote:
>
>> BOOST_ARCH_BITS_* is mostly a macro for sizeof(void*).
>>
>> In other words:
>> * define BOOST_ARCH_BITS_64 to 1 on BOOST_ARCH_x86_64, BOOST_ARCH_ARM_64,
>> BOOST_ARCH_PPC_64
>> * define BOOST_ARCH_BITS_32 to 1 on all other archs.
That would be incorrect because there are other 64-bit architectures
besides those listed above. For gcc and alikes you can use the
__SIZEOF_POINTER__ predefined macro, this would conveniently cover
most of the architectures.
> That appears to be of limited use. I would much rather see this
> extended to macros for data models (e.g. LP32, LP64, ILP64, etc.)
>
> http://www.unix.org/whitepapers/64bit.html
I think adding integer sizes to the macro semantics is going to be
unhelpful. Pointer size is often taken as an indicator of the target
addressing mode and integer sizes are irrelevant for that. In fact,
when you care about integer sizes you'll just use intXX_t types
regardless of the sizes of the builtin integer types.
I also think that the proposed naming is confusing. I would suggest
BOOST_ARCH_ADDRESS_MODEL (to follow the Boost.Build option) or
BOOST_ARCH_POINTER_SIZE.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk