try-catch 在RELEASE版无法捕捉错误,DEBUG可以
rbcic 2007-04-14 02:20:48 一个简单的测试程序
int main(int argc, char* argv[])
{
try
{
char *p = NULL;
strcpy(p,"0");
printf("\n[%s]\n",p);
}
catch(...)
{
printf("\ncatch error\n");
}
return 0;
}
在DEBUG版下可以出现 catch error,RELEASE程序仍然崩溃。在C/C++编译选项里已经加上了/GX 勾上了Enable exception handing。为什么啊?
还有个问题就是使用catch(...)捕捉所有异常,有没有什么办法知道是什么异常错误?