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 02 '26
It sounds like quite a beast to handle! I very much agree that crashing in that case is absurd. But it sounds like those errors you mention are expected to happen every now and then, and they could be therefore handled as regular data without the need for exceptions.
But please note what logical exceptions are: they are things that should simply never happen, like out of bounds errors. Programming mistakes, in other words. Assertions should be reserved for such very strong cases, like "if zero is equal to one please commit harakiri because you have gone nuts".