C ++异常和结构化异常之间的区别 [英] Difference between a C++ exception and Structured Exception

查看:93
本文介绍了C ++异常和结构化异常之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以解释MFC中的C ++异常和结构化异常之间的区别吗?

Can someone explain the difference between a C++ exception and a structured exception in MFC?

推荐答案


  • C ++异常,由编译器执行( try / catch

  • 结构化异常处理(SEH),由Windows提供( __ try / __ except

  • MFC异常宏( TRY CATCH - 建立在SEH / C ++异常之上 - 参见TheUndeadFish的注释)

  • C++ exceptions, implemented by the compiler (try/catch)
  • Structured Exception Handling (SEH), provided by Windows (__try / __except)
  • MFC exception macros (TRY, CATCH - built on top of SEH / C++ exceptions - see also TheUndeadFish's comment)

C ++异常通常保证自动清理在堆栈展开(即本地对象运行的析构函数)期间,其他机制不会。

C++ exceptions usually guarantee automatic cleanup during stack unwinding (i.e. destructors of local objects run), the other mechanisms don't.

C ++异常仅在明确抛出时才会发生。任何操作都可能发生结构化异常。

C++ exceptions only occur when they are explicitly thrown. Structured Exceptions may occur for any operation.

MFC引入了异常宏来支持异常,即使编译器没有实现它们。

MFC did introduce the exception macros to support exceptions even if compilers didn't implement them.

这篇关于C ++异常和结构化异常之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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