Topic: broken uncaught_exception() (Was: Exceptions specifications (Was: C++ as PL/1))


Author: Valentin Bonnard <bonnardv@pratique.fr>
Date: 1998/08/08
Raw View
> But in this
> specific case, std::uncaught_exception() tells the destructor
> (correctly) that there's an uncaught exception lying around
> (namely the one thrown by f), and therefore OpenFile::~OpenFile()
> won't throw, although it is safe to throw. Therefore the logging
> failure will remain unnoticed, although it would have been
> completely safe to throw.

You have identified a bug in the uncaught_exception
specification (I already new that, BTW).

I think that uncaught_exception() should be corrected in a
DR if we want to make it really usefull. uncaught_exception()
should indicate if we are destroying because of stack walkback,
not if there is an exception in some unrelated part of the
system.

--

Valentin Bonnard                mailto:bonnardv@pratique.fr
info about C++/a propos du C++: http://pages.pratique.fr/~bonnardv/


[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]






Author: "Paul D. DeRocco" <pderocco@ix.netcom.com>
Date: 1998/08/09
Raw View
Valentin Bonnard wrote:
>
> I think that uncaught_exception() should be corrected in a
> DR if we want to make it really usefull. uncaught_exception()
> should indicate if we are destroying because of stack walkback,
> not if there is an exception in some unrelated part of the
> system.

I think it was proven a while back there is no way to handle this
situation in a robust manner without have a test function that takes an
actual exception (or type_info for an exception type) as a parameter. In
any situation there are some exceptions that can be thrown safely
because they will be caught, but others that cannot because they will
leak out and abort a destructor.

In other words, we want

 bool can_throw(const type_info&);

--

Ciao,
Paul


[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]