|
Boost : |
From: Beman Dawes (bdawes_at_[hidden])
Date: 2002-01-18 11:08:17
At 09:33 AM 1/18/2002, David Abrahams wrote:
>----- Original Message -----
>From: "terekhov" <terekhov_at_[hidden]>
>
>> > Not really. Sometimes, for example at a 'C' API boundary, you
>> simply have to
>> > use catch(...) so you can prevent an exception from crashing your
>> caller.
>> > Tom Becker has already pointed that out.
>>
>> Perhaps Tom Becker or you could clarify this issue a bit more...
>> (for slowly thinking people, such as me and a couple of my
>> colleagues here)
>
>If you are writing C++ code that gets called from another language, you
>generally can't let an exception propagate out of your outer-level
>function.
>If you don't happen to know the exception, at least you can report /some/
>error. If you don't catch(...), you will crash your caller unless you
>happen to know (a base of) every exception type that can propagate into
>your function.
Dave,
While I can understand you not wanting to invest the effort of writing a
book on exceptions, please consider some other way of transferring your
knowledge to others.
For example, developing your paper
http://www.boost.org/more/error_handling.html into an exception handling
FAQ.
The FAQ format seems well suited to organic growth. ("Organic" is a
euphemism for unorganized growth:-) You just add to the document as issues
arise. Your answer above gets added under something like "Is catch(...)
without a rethrow ever appropriate?"
Over time, the document grows into something really worthwhile. Far more
valuable that just the sum of the value of its parts.
--Beman
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk