TRY / CATCH_ALL vs try / catch [英] TRY/CATCH_ALL vs try/catch
问题描述
我一直在使用c ++一段时间,我熟悉正常的try / catch。不过,我现在发现自己在Windows上,在VisualStudio中进行COM开发编码。代码的几个部分使用的东西如下:
I've been using c++ for a while, and I'm familiar with normal try/catch. However, I now find myself on Windows, coding in VisualStudio for COM development. Several parts of the code use things like:
TRY {
... do stuff
} CATCH_ALL(e) {
... issue a warning
}
END_CATCH_ALL;
这些宏的要点是什么?我们尝试过谷歌搜索,但尝试vs TRY很难搜索。
What's the point of these macros? What benefit do they offer over the built-in try/catch?
p>
推荐答案
这是一个MFC宏:
http://msdn.microsoft.com/en-us/library/t8dwzac0%28VS.71%29.aspx
这个页面说他们是MFC 1.0的补充 - 在新的代码中使用正常的C ++异常:
This page says they're a remnant from MFC 1.0 - use normal C++ exceptions in new code:
MFC版本较低比3.0不支持C ++异常机制。 MFC提供宏来处理异常。
MFC versions lower than 3.0 did not support the C++ exception mechanism. MFC provided macros to deal with exceptions.
这篇关于TRY / CATCH_ALL vs try / catch的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!