A slight change from C++98 to C++11, tightening up destructor semantics. Yes, it's still considered a best practice to never allow an exception to escape from a destructor -- in any language with destructor or Dispose
functionality -- and now we have an additional reason in C++11:
noexcept Destructors
by Andrzej Krzemieński
From the article:
The goal of this post is to show one — fairly small — backwards incompatibility in C++11. It shows how
noexcept
exception specifications are implicitly generated for your destructors. In short, the following program used to run successfully in C++03 (under some definition of “success”): ...In this post I do not intend to argue whether it is a bad practice or not to throw from destructors, but focus on what happens when you do. But I really do not encourage you to throw from destructors...
Add a Comment
Comments are closed.