r/cpp • u/pavel_v • Apr 02 '26
What happens when a destructor throws
https://www.sandordargo.com/blog/2026/04/01/when-a-destructor-throws
102
Upvotes
r/cpp • u/pavel_v • Apr 02 '26
View all comments
Show parent comment
1
u/fluorihammastahna Apr 03 '26
Ok, your earlier comment seemed to say that runtime errors were really with logical exceptions.
One use for logical exceptions is to add more information and aid troubleshooting, and exiting with a well-defined exit code.
Making it pretty much impossible for a program to fail has serious risks, like hiding a memory corruption and potential security issues. How do you make sure you don't let critical problems slip by?