开发者

How C++ exception implemented (using Setjump() & Longjump() ?) [duplicate]

开发者 https://www.devze.com 2023-03-09 12:01 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicates: How is the C++ exception handling 开发者_如何学Cruntime implemented?
This question already has answers here: Closed 11 years ago.

Possible Duplicates:

How is the C++ exception handling 开发者_如何学Cruntime implemented?

How do exceptions work (behind the scenes) in c++

Dear All,

I want to know, how C++ exception is implemented ?

Is it actually using Setjump() & Longjump() concepts as in build?


The standard does not define how exceptions have to be implemented by the compiler vendors. The two main strategies are to keep track of catch locations in a table or to unwind the stack frames until a suitable catch site is found.

MSVC for example uses SEH (Structured Exception Handlers) to implement C++ exceptions, while GCC uses a pure address table approach. Other compilers still, may use stack unwinding if they preserve enough frame information.


You should check Section 15.1 Throwing an exception of the standard.

0

精彩评论

暂无评论...
验证码 换一张
取 消