Re: [Boost-users] error_code using c++11 and boost
On 11/16/18 4:06 PM, Lars via Boost-users wrote:
Would it be possible for boost to implement some sort of convertion method from boost::system::error_code to std::errror_code?
The upcoming 1.69 release of Boost.System has built-in support for std::error_code. If you need to use earlier versions, then you can create a bridge between the two: http://breese.github.io/2016/06/18/unifying-error-codes.html
On Fri, 16 Nov 2018 at 18:46, Bjorn Reese via Boost-users
The upcoming 1.69 release of Boost.System has built-in support for std::error_code.
I was looking into this and got really confused. - I don't see any mention to that in https://www.boost.org/users/history/version_1_69_0.html - I guess it is https://github.com/boostorg/system/commit/6010be4144ce126e79a7eee56f5b40eef8..., but that has been there since 1.65 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 (https://github.com/boostorg/system/commit/65e14ff1670ea4cf41fb31d989b31ce9d9...). 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. So it looks like, - Boost.System has been getting header-only for years - Boost.Chrono has considered Boost.System header-only-ready since 1.55 - Boost.System considers itself header-only-ready since 1.69 - Boost.System has had built-in support for std::error_code since 1.65... but it has never been officially announced, so it's unclear how good that support is, including in the upcoming 1.69. Anybody has any more info about all this?
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 (https://github.com/boostorg/system/commit/65e14ff1670ea4cf41fb31d989b31ce9d9...). 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 libraries. 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 cases. 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.)
participants (3)
-
Bjorn Reese
-
Cristian Morales Vega
-
Gavin Lambert