Boost logo

Boost :

Subject: Re: [boost] [thread] Can Boost.Thread use Boost.Atomic withoutfalling on a compatibility issue?
From: Howard Hinnant (howard.hinnant_at_[hidden])
Date: 2013-01-14 13:26:57


On Jan 14, 2013, at 1:11 PM, "Peter Dimov" <lists_at_[hidden]> wrote:

> Howard Hinnant wrote:
>> There are a couple of places in libc++ that need to be retrofitted to use <atomic>. In the cases where that retrofit is in a header (i.e. call_once), the retrofit will currently need to be protected by __has_feature(cxx_atomic) as clang shuts this feature off in C++03 mode.
>
> Not very on-topic, but... what does it mean that clang shuts the feature off? I see in <atomic> that you issue an #error when !__has_feature(cxx_atomic), but what would happen if this is removed? Don't the C11 intrinsics work regardless?

I have no idea. I just checked the clang page and cxx_atomic appears to be undocumented. There is also a documented __has_feature(c_atomic).

I just ran this test in C++03 mode:

#include <iostream>

int main()
{
    std::cout << __c11_atomic_is_lock_free(1) << '\n';
    std::cout << __has_feature(c_atomic) << '\n';
}

It outputs:

1
0

I'm not sure what to make of that, or how much it can be trusted.

Howard


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