Subject: Re: [boost] throw or boost::throw_exception?
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2014-05-30 05:07:11
On Friday 30 May 2014 10:29:02 Andrzej Krzemienski wrote:
> I am not sure where, but I am convinced that I have read that it is
> recommended for Boost libraries that they not use naked throw expressions
> but instead call boost::throw_exception. Is that true?
Yes. In fact, most of the time it's better to use BOOST_THROW_EXCEPTION macro.
> If so, it enforces a dependency of more than half Boost libraries on
> Boost.Exception. Am I right?
Yes, as long as the necessary headers reside in Boost.Exception.
> If so, is this the right recommendation in the context of the discussion
> about reducing dependencies between the libraries?
I don't see a problem with that. Boost.Exception is extremely lightweight and
its functionality is often useful when it comes to dealing with exceptions.
Aside from being a configurability point, BOOST_THROW_EXCEPTION attaches
position in the code to the exception.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk