Lifecycle of thrown exceptions in C++
问题 Consider the following simple C++ code: void foo() { throw(my_exception()); } void check_exc(const my_exception &exc) { /* Do stuff with exc */ } void bar() { try { foo(); } catch(const my_exception &exc) { check_exc(exc); } } In bar 's exception handler, how comes the exception referenced by exc is still alive, seeing as how it was allocated in foo 's stack frame? Shouldn't that frame have been unwound by the time the exception handler gets to run, and any values allocated there already be