ProAnswers.org

What do you mean by stack unwinding?

What do you mean by stack unwinding?

When an exception is thrown, C++ calls destructors to destroy all the objects formed since the beginning of the try block. The objects are destroyed in the reverse order of their formation. This process is called Stack unwinding.

It is a process during exception handling when the destructor is called for all local objects between the place where the exception was thrown and where it is caught.