Tous les livres

Professionnel

Applis À propos Coach Connexion Commencer la lecture

Computer Science · Glossaire

Qu'est-ce que « Stack unwinding » ?

Definition 1.15 University Computer Science — Year 2 · Chapitre 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.
Lire dans le chapitre →