Boost logo

Boost :

Subject: Re: [boost] [Stacktrace] review
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2016-12-16 15:48:57


On Fri, Dec 16, 2016 at 8:46 AM, Robert Ramey <ramey_at_[hidden]> wrote:

> For many C++ programs and libraries, the exception is a convenient way to
> handle errors and for this reason is widely used. Traditionally, library
> authors have documented exceptions that they threw and let user programs
> decide to catch and handle them. To deal with platforms which didn't
> provide exceptions we threw through boost::throw_exception. So far so
> good. But as we make bigger and more complex programs using mulitple
> libraries from different sources, this becomes somewhat of a problem to
> keep track of. And users would like to have systematic way of "unifying"
> them. So I'm thinking the real solution is to develop customs and idioms
> for usage by library authors which would permit users to specify the way
> they would like to see exceptions handled.
>

This is missing the point of using exceptions. Beyond a mechanism for
reporting errors, exceptions enforce postconditions: a function will either
succeed or it will not return. Specifically, note that even under
BOOST_NO_EXCEPTIONS, boost::throw_exception is NOT allowed to return, or
else it would be useless to library developers (because they couldn't use
it to enforce postconditions.)

There might be exceptions to this, but whether a function throws or not
should not be configurable by the user.

Emil


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