Boost logo

Boost :

Subject: Re: [boost] Boost and exceptions
From: Robert Ramey (ramey_at_[hidden])
Date: 2012-06-19 13:11:22


Emil Dotchevski wrote:
> On Mon, Jun 18, 2012 at 9:55 PM, Robert Ramey <ramey_at_[hidden]> wrote:
>
>> At some point, the definition of BOOST_NO_EXCEPTION was
>> hijacked to mean to something completely unrelated and totally
>> different. This broke a bunch of other libraries and resulting
>> in problems that plague us to this day. and of course the same goes
>> for BOOST_THROW_EXCEPTION.
>>
>
> BOOST_THROW_EXCEPTION (the macro) has never been changed, it did not
> exist prior to the acceptance of Boost Exception.
>
> Would anyone object if I changed these back to the original (sensible)
>> meanings?
>>
>
> You probably mean boost::throw_exception. Yes, I object that being
> changed because that would handicap Boost Exception. Note that users
> of Boost Exception need other Boost libraries to throw exceptions
> using boost::throw_exception in order to take advantage of Boost
> Exception.

Maybe we can reach some sort of compromise on this.

According to
http://www.boost.org/doc/libs/1_49_0/libs/config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__03_defects

"The compiler does not support exception handling (this setting is typically
required by many C++ compilers for embedded platforms). Note that there is
no requirement for boost libraries to honor this configuration setting -
indeed doing so may be impossible in some cases. Those libraries that do
honor this will typically abort if a critical error occurs - you have been
warned!"

a) This definition is in the current and all past documentation and should
be respected by all code
which uses the macro BOOST_NO_EXCEPTIONS

Reason: This is a clear meaning and it's been documented as such for many
years. Your interpretation
is at odds with the documentation. People who read the documentation and
code according to
it will be mislead.

b) boost::throw_exception should be rolled back to it's orginal meaning.

Reason:The problem here is that using something from the main boost
namespace creates
and unexpected and hidden dependency on another library. This occcurs
without the library
user getting notified at all. Much care has been expended so that those
things directly inside
the boost namespace (excluding convenience headers) be things which DO NOT
create
dependencies on other libraries. The current definition of
boost::throw_exception is the only
exception to this.

c) Those who want or need the features of the Boost Exception library should
be able to
get them with:

#include <boost/exception/throw_exception.hpp> // or maybe
<boost/exception.hpp>
...
boost::exception::throw_exception ....

Reason: This is in line with standard practice with all other libraries -
and for good reason.
It exemplifies the "don't pay for what you don't use" which is essential to
the success
of boost.

Robert Ramey


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