Subject: Re: [boost] [system] Header-only Boost.System by default ?
From: Marc Glisse (marc.glisse_at_[hidden])
Date: 2017-10-11 07:34:06
On Mon, 9 Oct 2017, Niall Douglas via Boost wrote:
>> Is there any reason why Boost system couldn't be set to be header only
>> by default ?
>> Defining both macros allows it :
>> Â - BOOST_SYSTEM_NO_DEPRECATED
>> Â - BOOST_ERROR_CODE_HEADER_ONLY
>> This ease, speeds up and reduces binary size greatly, that it's sad that
>> non-aware Boost User needs to link to some dll/so/dylib of Boost.System
>> per default.
>> It has been in many releases of Boost, wouldn't it be good to set it to
>> be the default for a next release ?
> The only correct and safe way to use error categories is from a shared
> library. In header only mode, multiple instances may appear and thus no
> longer be proper singletons. Stuff breaks in this situation, badly.
> The above macros are provided for those who don't care if error
> categories work correctly, or have taken additional measures to ensure
> correctness. Turning it on by default would lead to users making broken
> code without realising. It's a build config option for *advanced* users
> only, ones who know what they're doing.
Your explanation seems to apply to BOOST_ERROR_CODE_HEADER_ONLY.
BOOST_SYSTEM_NO_DEPRECATED is something completely different. As its name
implies, it removes some old misfeatures. Misfeatures that force people to
link with boost system even when they do not use it... And *not* using
error categories is something I can safely do without a shared library.
-- Marc Glisse