Boost logo

Boost :

From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2006-07-08 04:33:38


> I'm all for doing whatever possible to keep library users from
> inadvertantly doing stupid things, but I personally feel that in this
> case the benefits of using a pointer (being able to catch old
> exceptions and test for the
> optional exception_info) outweigh the dangers of users potentially
> doing something ridiculous with the exception_info pointer.

You are exactly right. But let me clarify, you can catch an exception with
no exception_info not only because it was thrown by "old" code, but also
because it was thrown by "3rd-party" code which doesn't know about the
exception library.

The exception library is not intended to change the way people handle
exceptions. You'd still be designing exception class hierarchies, and
catching references to those types, because that's how C++ expects you to
dispatch between different types of errors.

The most important design goals of the exception library are:

1) To free your exception classes from having to carry values, and

2) To allow values to be added to an exception that was already thrown,
regardless of its type, by catching exception_info & and re-throwing.

--Emil


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