全部书籍

专业

应用 关于 Coach 登录 开始阅读

书籍暂未推出简体中文版——当前显示英文版。

Computer Science · 术语表

什么是 Stack unwinding?

Definition 1.15 University Computer Science — Year 2 · 第 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.
在原文中阅读 →