Gruenke,Matt
2017-02-11 21:22:01 UTC
Actually, we just got burned by the fact that boost/asio/detail/atomic_count.hpp uses a different implementation for atomic_count in C++03 and C++11. One library had instantiated some Boost.ASIO templates, and was compiled in C++03 mode. When linked with other libraries, also using Boost.ASIO, that were compiled in C++11 mode, the template instantiations from the two got mixed. This resulted in hard-to-find errors, even though they didnât otherwise call each other.
It seems that, elsewhere in Boost, such issues have been resolved:
https://svn.boost.org/trac/boost/ticket/6779
I think it was a poor choice to vary the binary interface of ASIO, depending on the language standard being used. Boost.ASIO should try to harmonize with the rest of Boost, in this regard.
Looking at boost/asio/detail/config.hpp, I think the following should probably be the default:
BOOST_ASIO_DISABLE_STD_ARRAY
BOOST_ASIO_DISABLE_STD_SHARED_PTR
BOOST_ASIO_DISABLE_STD_ATOMIC
BOOST_ASIO_DISABLE_STD_CHRONO
BOOST_ASIO_DISABLE_STD_FUNCTION
BOOST_ASIO_DISABLE_STD_THREAD
BOOST_ASIO_DISABLE_STD_MUTEX_AND_CONDVAR
People should enable a standard type, only if they have a need to operate on members of those types with other code they have thatâs dependent on the standard library versions. Otherwise, it should be safe always to use the Boost versions.
Matt
From: Tatsuyuki Ishi [mailto:***@gmail.com]
Sent: Friday, December 09, 2016 04:47
To: asio-***@lists.sourceforge.net
Subject: [asio-users] Using C++11/Boost standard synchronization implementations
I think it's definitely better to use <thread>, <mutex>, <atomic> or the equivalent functions in Boost instead of a custom implementation.
Some points:
1. They're precompiled system libraries, while asio is commonly used as header-only. Using system libraries also reduce the redundant header inclusions.
2. Less things to manage.
3. std looks better in debugger.
________________________________
This e-mail contains privileged and confidential information intended for the use of the addressees named above. If you are not the intended recipient of this e-mail, you are hereby notified that you must not disseminate, copy or take any action in respect of any information contained in it. If you have received this e-mail in error, please notify the sender immediately by e-mail and immediately destroy this e-mail and its attachments.
It seems that, elsewhere in Boost, such issues have been resolved:
https://svn.boost.org/trac/boost/ticket/6779
I think it was a poor choice to vary the binary interface of ASIO, depending on the language standard being used. Boost.ASIO should try to harmonize with the rest of Boost, in this regard.
Looking at boost/asio/detail/config.hpp, I think the following should probably be the default:
BOOST_ASIO_DISABLE_STD_ARRAY
BOOST_ASIO_DISABLE_STD_SHARED_PTR
BOOST_ASIO_DISABLE_STD_ATOMIC
BOOST_ASIO_DISABLE_STD_CHRONO
BOOST_ASIO_DISABLE_STD_FUNCTION
BOOST_ASIO_DISABLE_STD_THREAD
BOOST_ASIO_DISABLE_STD_MUTEX_AND_CONDVAR
People should enable a standard type, only if they have a need to operate on members of those types with other code they have thatâs dependent on the standard library versions. Otherwise, it should be safe always to use the Boost versions.
Matt
From: Tatsuyuki Ishi [mailto:***@gmail.com]
Sent: Friday, December 09, 2016 04:47
To: asio-***@lists.sourceforge.net
Subject: [asio-users] Using C++11/Boost standard synchronization implementations
I think it's definitely better to use <thread>, <mutex>, <atomic> or the equivalent functions in Boost instead of a custom implementation.
Some points:
1. They're precompiled system libraries, while asio is commonly used as header-only. Using system libraries also reduce the redundant header inclusions.
2. Less things to manage.
3. std looks better in debugger.
________________________________
This e-mail contains privileged and confidential information intended for the use of the addressees named above. If you are not the intended recipient of this e-mail, you are hereby notified that you must not disseminate, copy or take any action in respect of any information contained in it. If you have received this e-mail in error, please notify the sender immediately by e-mail and immediately destroy this e-mail and its attachments.