Hacker News new | ask | show | jobs
by potiuper 1482 days ago
In C++, if the construction fails (with an exception), no other member function - not even the destructor - gets called and the resource is not acquired.
1 comments

This is one reason many people think exceptions in C++ are harmful, they cause unclear implicit behavior. Much better to handle a failure explicitly outside the constructor
This is one reason I use Pascal

If the constructor throws an exception, the destructor is called immediately.