Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2000-07-21 19:46:54

From: "Bill Wade" <bill.wade_at_[hidden]>

> A third possible use:
> throw(A,B,bad_exception)
> is a convenient shorthand for
> try{ stuff_that_might_throw(); }
> catch(A&){ throw; }
> catch(B&){ throw; }
> catch(bad_exception&){ throw; }
> catch(...){ unexpected(); }
> If you really do need to map all possible exceptions to a small set of
> exceptions (say those exceptions that you know how to send via smoke
> with an agreed-upon protocol), the notational convenience is handy.

I suspect that you're not really saving yourself anything in this case. If
you look at the code which sends the allowed exceptions via smoke-signals
I'd lay odds it looks a lot like the code above you are writing a shorthand
for ;) You could just drop the exception-specification and send a
bad_exception via smoke signal (however you do that!) in your catch(...)

> // Interface from my vendor. I can't change this
> In the absence of throw specifications the implementation of
> is much uglier and much more error prone. If the vendor was nice enough
> include bad_exception in foo_t::bar()'s throw list, and I decide to allow
> bad_exception to escape from my bar(), the implementation of my bar()
> becomes a trivial call to ComputeResultButMightThrowAnything().

Yes, but fortunately this sort of situation isn't really relevant to boost,
is it?


Boost list run by bdawes at, gregod at, cpdaniel at, john at