compiling boost using C++11 atomics
Hi, Is there any particular reason that boost isn't being compiled with BOOST_AC_USE_STD_ATOMIC and BOOST_SP_USE_STD_ATOMIC (by default) when C++11 support in g++ is available (g++ >= 4.7)? Thanks, Andre'
AndréDraszik wrote:
Hi,
Is there any particular reason that boost isn't being compiled with BOOST_AC_USE_STD_ATOMIC and BOOST_SP_USE_STD_ATOMIC (by default) when C++11 support in g++ is available (g++ >= 4.7)?
Support for <atomic> in earlier C++11 implementations wasn't reliable enough compared to shared_ptr's platform-specific implementations. Things nowadays have probably already reversed though, with <atomic> being more reliable. I could turn it on by default when BOOST_NO_CXX11_HDR_ATOMIC isn't defined, which according to Boost.Config would enable it on g++ 4.9 and above.
On Fr, 2016-08-26 at 21:45 +0300, Peter Dimov wrote:
André Draszik wrote:
Hi,
Is there any particular reason that boost isn't being compiled with BOOST_AC_USE_STD_ATOMIC and BOOST_SP_USE_STD_ATOMIC (by default) when C++11 support in g++ is available (g++ >= 4.7)?
Support for <atomic> in earlier C++11 implementations wasn't reliable enough compared to shared_ptr's platform-specific implementations. Things nowadays have probably already reversed though, with <atomic> being more reliable.
Thanks Peter.
I could turn it on by default when BOOST_NO_CXX11_HDR_ATOMIC isn't defined,
Something like the attached?
which according to Boost.Config would enable it on g++ 4.9 and above.
This would enable it on g++ >= 4.8 (not >= 4.9), though. https://github.com/boostorg/config/blob/develop/include/boost/config/stdlib/ libstdcpp3.hpp#L223 Cheers, Andre'
AndréDraszik wrote:
I could turn it on by default when BOOST_NO_CXX11_HDR_ATOMIC isn't defined,
Something like the attached?
More like this: https://github.com/boostorg/smart_ptr/commit/20fedcff2ca3143503ec4e876d47745... BOOST_SP_USE_STD_ATOMIC is a user macro that overrides the autodetection, so Boost.Config shouldn't set it.
On Aug 29, 2016 10:25, "André Draszik"
This would enable it on g++ >= 4.8 (not >= 4.9), though.
https://github.com/boostorg/config/blob/develop/include/boost/config/stdlib/
libstdcpp3.hpp#L223
IIRC g++4.8 has issues with atomic function pointers, so enabling it might have problems.
participants (3)
-
André Draszik
-
Jonathan Müller
-
Peter Dimov