
On Jan 14, 2013, at 1:11 PM, "Peter Dimov" <lists@pdimov.com> 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