Throwing from a destructor

I just read a very interesting article about throwing exceptions from destructors, by Jon Kalb and Dave Abrahams.

The article itself is nicely written and goes through some of the exception-safe advantages (for me RAII is by far the best reason to write solid exception-safe code) and explains why throwing an exception from a destructor might get you in trouble.

But the article's comments are the part where things get interesting. Several different interesting points of view are expressed there, as well as some comments about future possible changes to the standard. Some comments  just challenge the (dogma of the) currently accepted good practices.

I find it great to question some of the dogmas from time to time. Helps us keep things going in the right direction.

If you are interested in C++ programming, I think you really should read the article and comments.


Rui Pires

Working as a professional full time remote developer from the Azores since 2011.

Read More