Boost logo

Boost :

Subject: Re: [boost] BOOST_NO_CXX11_ATOMIC?
From: Beman Dawes (bdawes_at_[hidden])
Date: 2013-11-30 07:50:24


On Sat, Nov 30, 2013 at 4:32 AM, tim <tim_at_[hidden]> wrote:

> > Now is perhaps not a very appropriate time to ask, but why don't we seem
> to
> > have a macro for the <atomic> C++11 header?
>
> in my experience compilers may provide the <atomic> header without fully
> implementing its content:
>
> * some gcc versions only implement atomic<> for integral types, but not
> for structs
>
> * libc++'s atomic<> for structs is broken if the struct has a
> constructor (showstopper for boost.lockfree)
>
> if the macro whould indicate that atomic<> is somehow supported, it may
> be unreliable. otoh, if it is only set on a complete implementation of
> atomic<>, it may be too strict for many use cases, with may only require
> integral atomic types.
>
> so i'm not sure if such a macro would do more good than harm ...
> unfortunately :(
>

We have run into a similar situation with compilers initially providing
only partial implementations of language features. For example, Microsoft
only supporting unconditional noexcept. The de facto policy has been to
define the macro (BOOST_NO_CXX11_HDR_ATOMIC) until the feature is complete.
Anyone who wants to take advantage of a partial implementation can test for
the particular compiler or library version involved.

--Beman


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