Boost logo

Boost :

From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2022-02-14 20:53:01


On 14/02/2022 20:25, Peter Dimov wrote:
> Niall Douglas wrote:
>> On 13/02/2022 21:43, Peter Dimov via Boost wrote:
>>
>>> Recommendation two: add source locations to your error_codes if using
>>> Boost.System.
>>
>> That seems unwise advice to give unqualified. Every time you instance a
>> source location you add the path of your source file to your binary,
 which
>> bloats your binary.
>
> That's correct. In addition to bloating the binary, it also embeds
 potentially
> sensitive information into it (file and function names.)

Indeed.

> The macro BOOST_DISABLE_CURRENT_LOCATION, when defined, makes
> BOOST_CURRENT_LOCATION resolve to a default-constructed
> boost::source_location, which stores nothing except empty strings. See
>
>
 https://www.boost.org/doc/libs/develop/libs/assert/doc/html/assert.html#boost_current_location
>
> This mirrors the behavior of the already existing
> BOOST_DISABLE_CURRENT_FUNCTION, which has a similar purpose.

Given what you just agreed about above, shouldn't you flip the default
i.e. BOOST_SYSTEM_ENABLE_CURRENT_FUNCTION.

I also think you need a separate macro control for
boost::system::error_code's use of source location, because it won't be
unusual to want global source location function to be working but
error_code's use of it to be globally disabled.

Niall


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