Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-09-04 12:24:53


Alan.Griffiths_at_[hidden] writes:

>> -----Original Message-----
>> From: David Abrahams [mailto:dave_at_[hidden]]
>> Sent: 04 September 2003 12:57
>>
>> Alan.Griffiths_at_[hidden] writes:
>>
>> > As already established, fundamentally the problem stems from broken
>> > implementations
>>
>> Who established that, and how?
>
> You did. Or have I jumped to a conclusion here?
>
> It comes from a number of places - like the c.l.c++.m thread "Is internal
> catch-clause rethrow standard?" and is repeated in your paper at:
>
> http://www.boost.org/more/error_handling.html
>
> The relevent bit being:
>
> "I reluctantly concede this point to Hillel Y. Sims, who beat it into me
> (<wink>): until all OSes are "fixed", if every exception were derived from
> std::exception and everyone substituted catch(std::exception&) for
> catch(...), the world would be a better place."
>
> Which AFAICS is the motivation for catching via a potentially ambiguous base
> class reference in the first place.

Not at all. std::exception& is a good fallback for error reporting
*before* catch(...) reports "unknown exception" because you may be
able to get something from the what() string. Further, if you follow
Peter D's advice of using what() for a key into a table of messages,
you almost always want to catch(std::exception&).

-- 
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