Boost logo

Boost :

Subject: Re: [boost] [inspect] exceptions (FW: [Boost-users] no exceptions)
From: Robert Kawulak (robert.kawulak_at_[hidden])
Date: 2011-03-22 10:07:49


> From: Vladimir Prus
> Emil Dotchevski wrote:
> > <robert.kawulak_at_[hidden]> wrote:
> >>> From: Hochhaus, Andrew
> >>> a) throw exceptions with the "raw" throw keyword [instead of
> >>> BOOST_THROW_EXCEPTION or boost::throw_exception]
> >>> b) use try ... catch blocks without "#ifnef BOOST_NO_EXCEPTIONS" guards
> >>
> >> Wouldn't it be a good idea to add checks for these to the inspect tool? Also, non-empty
> >> exception specifications are discouraged by Boost guidelines - should appropriate checks be
> >> added too?
> >
> > +1
>
> I don't think that Boost libraries are required to support non-conforming compilers or
> operation modes of compilers, therefore adding inspect check for a workaround for such
> non-comforming behaviour would be wrong, I think.

For try/catch blocks you're right. As to BOOST_THROW_EXCEPTION, it is not only about supporting non-conforming compilers. It is a
customisation point for exception handling behaviour of Boost libraries just like BOOST_ASSERT is for assert, so it is important
that it's used consistently in all Boost libraries to make it make sense. It also automatically adds useful exception origin
information like file/line/function, which makes debugging programs using Boost faster and easier. I think using
BOOST_THROW_EXCEPTION should be added to the Boost guidelines page in the first place, but Boost.Inspect should also enforce this.

As to exception specifications, IIRC this has nothing to do with non-conforming compilers - it is a general C++ style guideline and
Boost guidelines page also recommends it.

Best regards,
Robert


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