Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-11-04 13:50:15


"E. Gladyshev" <egladysh_at_[hidden]> writes:

> Now, if we assume that in *real* life handling exceptions
> *explicitly* is "safer" than catch(...), we are in trouble with
> generic programming. It will mean that as soon as you call a user
> defined type/functor from a generic library, in generic context, you
> don't know what exceptions a correct implementation of this type can
> possibly generate. So ideally every generic function should expose
> exception handling policies or the best the generic function can do
> is to catch all exceptions (catch(...)) and use a system call or
> other low-level means to stop the execution. The low-level call can
> be defines as a policy as well.

If your system gives you cause to worry about catch(...), it's much
simpler to use the destructors of automatic objects than to define
such a complicated mechanism for recovery.

> So the claim that "Interactions between templates and exceptions are
> not well-understood." might after all be true in opposite to what
> your article is suggesting.

Just as the article suggests, these issues are exactly the same ones
that arise with library functions which accept function pointers or
(runtime) polymorphic objects. There's no particular mysterious
interaction with templates.

And this is my last post in this thread. I hope it helped,

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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