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
Those sound more like runtime exceptions, because it is possible to write a program that triggers them. Logical exceptions should be impossible to trigger: no matter what input you throw, which order you call functions etc, an out-of-bounds error should never, ever happen by design.
I strongly recommend looking through the <exception> documentation and see which ones exist and what they are supposed to be used for.