Alle boeken

Professioneel

Apps Over Coach Inloggen Begin met lezen

Computer Science · Begrippenlijst

Wat is Stack unwinding?

Definition 1.15 University Computer Science — Year 2 · Hoofdstuk 1 — From C to C++: Classes and Resource Management

Between a throw and the handler that catches it, the program leaves every block and every function in between. Stack unwinding is this departure: each frame left is popped, and each automatic object of each block left is destroyed, in the reverse order of construction, as if its block had ended.

The frames of  when parse(3) throws, the newest on top. Unwinding pops frames downward to the frame whose try block has a matching handler, destroying each object it passes, then runs the handler.
The frames of Listing 1.10 when parse(3) throws, the newest on top. Unwinding pops frames downward to the frame whose try block has a matching handler, destroying each object it passes, then runs the handler.
Lees in het hoofdstuk →