Visual Studio 6 何时捕获结构化异常?
这主要是出于好奇,但我一直在阅读有关 Visual Studio 在 C++ try-catch
构造中捕获 SEH 异常的历史。我一直在断言启用了 /GX 标志的旧版本 Visual Studio 会“有时”在 C++ catch
块中捕获结构化 Win32 异常。
在使用 /GX 标志构建时,Visual Studio 6.0 在什么情况下会在以下代码中输入 catch 块?
char * p = NULL;
try
{
*p = 'A';
}
catch(...)
{
printf("In catch\n");
}
在我自己使用 Visual Studio 6 + SP6 进行的简单测试中,程序执行因未处理的异常而停止,并且“ In catch”永远不会被打印。但是,有些文章(例如这篇)导致我相信可以进入 catch
块。
This is mostly curiosity, but I've been reading about the history of Visual Studio catching SEH exceptions in a C++ try-catch
construct. I keep running across the assertion that older versions Visual Studio with the /GX flag enabled would "somtimes" catch structured Win32 exceptions in a C++ catch
block.
Under what circumstances will Visual Studio 6.0 enter the catch block in the following code when built with the /GX flag?
char * p = NULL;
try
{
*p = 'A';
}
catch(...)
{
printf("In catch\n");
}
In my own simple tests with Visual Studio 6 + SP6 program execution halts with an unhanded exception and "In catch" is never printed. However, some articles (like this one) lead me to believe that it's possible to enter the catch
block.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这也许是我通过网络找到的唯一方法。
据我猜测,即使您知道为什么处理此类异常不好,但对于来这里的谷歌人来说,请阅读:
http://members.cox.net/doug_web/eh.htm#Q1
Thats Perhaps the only way I found Looking over the net.
Also as I can guess Even you know why it is not good to handle such exceptions, still for googlers coming here, do read :
http://members.cox.net/doug_web/eh.htm#Q1