简体   繁体   中英

What could prevent a stack unwinding process in C++?

I'm not sure how to approach it. The question was given after a lecture about Exceptions so I assume it has something to do with it.

Default signal handlers, or calls to abort() and exit() could prevent stack unvinding.

And there's many more situations, like pointed out in mah's comment .

Especially any mechanism bypassing the c++ exception model will do so. Even threads have a model to do proper stack unwinding, with having them propagated to their parents (if they weren't detached).

When a scope is exited, stack unwinding starts, which means the compiler inserts calls to destructors of automatic variables, as explained in this answer .

For this process to be prevented, you would need a sudden exiting of the process, which could be loss of power, force quitting the process through the command line, etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM