16,472
社区成员
发帖
与我相关
我的任务
分享
try
{
int *p = NULL;
int a = *p;
int b = 100;
int c= b/0;
delete p;
//throw(1);
AfxMessageBox(L"do not catched");
}
catch(...)
{
AfxMessageBox(L"catched");
}
__try
{
int *p = NULL;
int a = *p;
int b = 100;
int c= b/0;
delete p;
//throw(1);
AfxMessageBox(L"do not catched");
}
__except( EXCEPTION_EXECUTE_HANDLER )
{
AfxMessageBox(L"catched");
}
这样也没有捕获到.什么原因呢?[/quote]
中间的代码被优化掉了,改一下,数据有程序读入。[/quote]
改成成员变量,就可以捕获到了..囧.
__try
{
int *p = NULL;
int a = *p;
int b = 100;
int c= b/0;
delete p;
//throw(1);
AfxMessageBox(L"do not catched");
}
__except( EXCEPTION_EXECUTE_HANDLER )
{
AfxMessageBox(L"catched");
}
这样也没有捕获到.什么原因呢?[/quote]
中间的代码被优化掉了,改一下,数据有程序读入。
__try
{
int *p = NULL;
int a = *p;
int b = 100;
int c= b/0;
delete p;
//throw(1);
AfxMessageBox(L"do not catched");
}
__except( EXCEPTION_EXECUTE_HANDLER )
{
AfxMessageBox(L"catched");
}
这样也没有捕获到.什么原因呢?