On Thursday, 4 February 2016 at 10:03:13 UTC, Jonathan M Davis
wrote:
On Wednesday, February 03, 2016 23:55:42 Ali Çehreli via
Digitalmars-d-learn wrote:
std::uncaught_exception used to be considered useless:
I think that the only case I've ever had for it was for a unit
testing framework where I wanted to use RAII to print something
when the tests failed (and thus an exception was thrown) but
not print if they succeeded, and if I were to do that in D, I'd
just use scope(failure).
Well, yes, it is useful for logging. It is useful to know if an
invariant is broken during regular unwinding (serious error) or
exceptional situations (might be unavoidable).
But I think Herb Sutters major point was that if you had multiple
destructors it could not detect where the exceptions originate
from. So C++17 has a new function that returns the number of
uncaught expressions:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4152.pdf