|
Boost : |
Subject: Re: [boost] throw or boost::throw_exception?
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2014-05-30 15:05:00
On Fri, May 30, 2014 at 2:07 AM, Andrey Semashev
<andrey.semashev_at_[hidden]> wrote:
> On Friday 30 May 2014 10:29:02 Andrzej Krzemienski wrote:
>> Hi,
>> 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?
You're technically correct but this dependence is very lightweight: a
single file (boost/exception/exception.hpp) designed specifically for
that purpose. It's about 200 lines of self-contained code which
doesn't include anything. This code is needed to enable the use of the
rest of Boost Exception, which can not work without it.
That said, the user can specify BOOST_EXCEPTION_DISABLE to disable the
integration of Boost Exception into boost::throw_exception. See
www.boost.org/doc/libs/release/libs/exception/doc/configuration_macros.html.
-- Emil Dotchevski Reverge Studios, Inc. http://www.revergestudios.com/reblog/index.php?n=ReCode
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk