Not a good idea to throw exceptions in destructor in C++

When using try-catch blocks in C++, it is not a good to throw exceptions in destructor. Briefly, it may cause SIGABORT at runtime since the exception thrown in destructor may not be caught.

In MAC OS, you will get a “terminate called without an active exception” error. Then cause unexpected errors further on.

In Linux and Windows, the exception thrown in destructor will be caught by system. Then the program terminates

Continue reading Not a good idea to throw exceptions in destructor in C++