Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

“堆栈回退”我认为您要表达的是:“栈回溯” #285

Closed
Mq-b opened this issue May 20, 2024 · 1 comment · Fixed by #287
Closed

“堆栈回退”我认为您要表达的是:“栈回溯” #285

Mq-b opened this issue May 20, 2024 · 1 comment · Fixed by #287

Comments

@Mq-b
Copy link
Contributor

Mq-b commented May 20, 2024

  • 文件路径:book/zh-cn/07-thread.md

web 位置

原文:

由于 C++ 保证了所有栈对象在生命周期结束时会被销毁,所以这样的代码也是异常安全的。 无论 critical_section() 正常返回、还是在中途抛出异常,都会引发堆栈回退,也就自动调用了 unlock()。

首先“栈回溯”这个词更加常见与明确,其次,“堆栈”这个词,非常不好,参见:Qihoo360/safe-rules#54

且我觉得有必要强调一句话:

  • 没有捕获抛出的异常(此时由实现定义是否进行栈回溯)

因为原文的描述在我看来暗示了所有情况都会进行栈回溯。

@changkun
Copy link
Owner

Thanks and PR welcome

Mq-b added a commit to Mq-b/modern-cpp-tutorial that referenced this issue May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants