Boost logo

Boost Users :

Subject: Re: [Boost-users] error_code using c++11 and boost
From: Gavin Lambert (boost_at_[hidden])
Date: 2018-12-06 22:20:38

On 7/12/2018 03:34, Cristian Morales Vega wrote:
> One "new" thing listed in the 1.69 release notes is "Boost.System is
> now header-only". But I can see a reference to
> BOOST_ERROR_CODE_HEADER_ONLY in Boost.System from 2012
> (
> And Chrono documentation has been documenting the "undocumented
> feature" (BOOST_ERROR_CODE_HEADER_ONLY) for a long time. Up to 1.54 it
> said "but it is buggy (see #7347 duplicate symbol while
> BOOST_ERROR_CODE_HEADER_ONLY is defined)", but that warning was
> removed in 1.55.

BOOST_ERROR_CODE_HEADER_ONLY only worked correctly with *some* build
configurations and platforms -- notably, error categories that should
compare equal did *not* do so with some combinations of DLLs and shared

It was not defined by default so that people have to consciously decide
to shoot themselves in the foot (or that they have tested that for their
particular application and platform it is not a problem).

In 1.69, the way that error_category comparison works has been altered
(see the new constructor mentioned in the release notes), which permits
distinct category objects to still compare equal, which means that it is
now safe to build the standard error_category objects header-only in all

What perhaps should be emphasized a bit stronger in the release notes is
that it would be a very good idea for any custom error_category objects
(especially those in libraries) to make use of these ids as well. (It's
documented how to do that in the reference docs for the constructor.)

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at