|
Boost Users : |
Subject: Re: [Boost-users] no exceptions
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2011-03-21 20:01:45
On Mon, Mar 21, 2011 at 4:13 PM, Hochhaus, Andrew
<ahochhaus_at_[hidden]> wrote:
> Hi,
>
> I would like to use boost with BOOST_NO_EXCEPTIONS [1] and the g++
> -fno-exceptions flag. However, it appears that some spots in boost
> library code:
>
> 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
>
> This leaves me with the following questions.
>
> 1) Is BOOST_NO_EXCEPTIONS actively supported or a legacy construct?
It is actively supported.
> 2) What is the "recommended" way to throw exceptions inside boost
> library code (BOOST_THROW_EXCEPTION, boost::throw_exception, etc)?
For BOOST_NO_EXCEPTIONS to work, it is sufficient to use
boost::throw_exception to throw. However, it is recommended to use
BOOST_THROW_EXCEPTION instead, which has the benefit of storing the
file and line number into the exception object. See
http://www.boost.org/doc/libs/release/libs/exception/doc/BOOST_THROW_EXCEPTION.html.
> 3) If this is not intended behavior, would incremental patches to
> remove these dependencies be considered for inclusion?
You mean dependencies on boost/throw_exception.hpp? I'd think that
patches that convert naked throws to BOOST_THROW_EXCEPTION should be
accepted, since the boost/throw_exception.hpp header is extremely
lightweight.
Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net