logoalt Hacker News

leni536yesterday at 10:07 AM1 replyview on HN

Not to mention that the `scope_success` and `scope_failure` variants have to use `std::uncaught_exceptions()`, which is hostile to codegen and also has other problems, especially in coroutines. C++ could get exception-aware variants of language defer.


Replies

layer8yesterday at 2:49 PM

What C++ really needs is an automated way to handle exceptions in destructors, similar to how Java does in its try-with-resources finally blocks.

show 1 reply