Boost logo

Boost :

Subject: Re: [boost] [Stacktrace] review
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2016-12-15 01:36:41


On 15/12/2016 13:53, Robert Ramey wrote:
> I think that there has been a lot of confusion about what
> BOOST_THROW_EXCEPTION is suppose to do.
>
> My understanding was that it was a macro intended to support the writing
> of portable code that could run on platforms which didn't support
> exceptions or where the user / author didn't want to use the exception
> mechanism so he could redefine the macro. Lot's of libraries used this
> idiom to decouple their libraries from the the selection of exception
> mechanism.

Shouldn't a macro with that intent be defined in
core/no_exceptions_support.hpp instead?

(There currently doesn't appear to be a throw macro there, presumably
because boost::throw_exception was sufficient?)

> With the acceptance of Boost.Exception, this BOOST_THROW_EXCEPTION
> was repurposed to call boost.exception. Obviously not what previous
> users of BOOST_THROW_EXCEPTION intended or expected. This made many
> libraries dependent on the new library boost.exception which had
> multiple repercussions - one of which is that boost.exception has now
> become a "core library" - not sure what that is supposed to mean.

It doesn't really look like (at least in current code) that
BOOST_THROW_EXCEPTION has any function unless you want to capture the
error_info automatically. Otherwise you can just always use
boost::throw_exception instead.

If you want to use BOOST_THROW_EXCEPTION without depending on
Boost.Exception, it looks like you can define BOOST_EXCEPTION_DISABLE,
although at the cost of losing the current_exception and error_info
wrappers.

This is independent of BOOST_NO_EXCEPTIONS, which controls whether
exceptions are thrown at all.


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