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
0
u/fluorihammastahna Apr 02 '26
It's not that your comment is rude, it's simply that it's RTFM-level of uninformative. Any seasoned C++ developer should be alert about these articles, like "Oh crap what basic misunderstanding do I have now about this basic feature". I definitely expect caveats about terminate I am not aware of. I use terminate for things like logical errors that cannot be enforced via language, like reaching a default: where I've dealt with all enum values.
Terminating or just letting the program die is much better than handling an exception to let the program continue in the vast majority of cases. In the first case, you will always be sure that there is something to fix, and in the second at the very least you are semantically mixing up runtime events with actual errors, and at worst letting critical problems slip.