C ++异常处理如何转换为机器代码 [英] How does C++ exception handling translate to machine code

查看:91
本文介绍了C ++异常处理如何转换为机器代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从心理上讲,我一直想知道当C ++编译将try / throw / catch转换为汇编器时,幕后情况如何。但是由于我从未使用过它,所以我从没去过检查它(有人会说是懒惰)。

Mentally, I've always wondered how try/throw/catch looks behind the scenes, when the C++ compiles translates it to assembler. But since I never use it, I never got around to checking it out (some people would say lazy).

是用于跟踪<$ c的普通堆栈$ c> try s,还是为此目的单独保留每个线程堆栈? MSVC和g ++之间的实现是大还是小?请给我看一些伪汇编(IA-32也可以),这样我就不必亲自检查了! :)

Is the normal stack used for keeping track of trys, or is a separate per-thread stack kept for this purpose alone? Is the implementation between MSVC and g++ big or small? Please show me some pseudo asm (IA-32 is ok too) so I never have to check it out myself! :)

编辑:现在,我了解了MSVC在IA-32处理上的实现基础。有人知道在IA-32上使用g ++还是其他任何CPU?

Now I get the basics of MSVC's implementation on IA-32 handling. Anybody know for g++ on IA-32, or any other CPU for that matter?

编辑2(11年后): 此处是一些有关性能的数据。他们还免费提供了源代码

Edit 2 (11 years later): Here are some data on performance. They've also made source code freely available.

推荐答案

Microsoft Journal的 Under the Hood系列在1997年对该主题进行了深入研究:

Microsoft Journal's "Under the Hood" series did an in-depth look at that very subject back in 1997:

有关Win32™结构化异常处理的深度的速成课程

这篇关于C ++异常处理如何转换为机器代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆