How are exceptions implemented under the hood?

前端 未结 10 1448
粉色の甜心
粉色の甜心 2020-12-07 07:43

Just about everyone uses them, but many, including me simply take it for granted that they just work.

I am looking for high-quality material. Languages I use are: Ja

10条回答
  •  伪装坚强ぢ
    2020-12-07 08:46

    Here is a common way C++ exceptions are implemented:
    http://www.codesourcery.com/public/cxx-abi/abi-eh.html

    It is for the Itanium architecture, but the implementation described here is used in other architectures as well. Note that it is a long document, since C++ exceptions are complicated.

    Here is a good description on how LLVM implements exceptions:
    http://llvm.org/docs/ExceptionHandling.html

    Since LLVM is meant to be a common intermediate representation for many runtimes, the mechanisms described can be applied to many languages.

提交回复
热议问题