Boost logo

Boost :

Subject: Re: [boost] throw or boost::throw_exception?
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2014-05-31 04:23:13


On Saturday 31 May 2014 08:39:52 John Maddock 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?
> >
> > 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.
>
> I'm starting to wonder if all the "workaround" headers should be moved
> into Config (provided they don't depend on anything else). This would
> be one candidate I guess?

You mean boost/exception/exception.hpp? That doesn't look like a workaround
header.

I would argue that boost/exception/detail/attribute_noreturn.hpp or similar
header should be in Boost.Config. I needed such macro a few times and pulling
it from Boost.Exception is awkward.

> Possible others would be
>
> boost/cerrno.gpp
> boost/cstdlib.hpp
> boost/cstdint.hpp
>
> Thoughts? John.

I'm ok with these 3.


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