C ++尝试catch不处理错误。应用程序继续崩溃。在WINCE上 [英] C++ try catch not handling the error. Application keep on crashng. On WINCE
本文介绍了C ++尝试catch不处理错误。应用程序继续崩溃。在WINCE上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试处理一个函数内的问题。我不知道会有什么错误。但是想要处理该函数内部发生的所有错误。我把try catch。但我的申请仍然被压垮了。谢谢。
On WinCE
我尝试过的事情:
所以我尝试了一个简单的代码
Hi,
I try to handle a issues inside one function. I dont know what error will come there. But want to handle all the error occurs inside that function. I put try catch. But still my application is crushed. Thank you.
On WinCE
What I have tried:
So I tried a simple code
try{
int n=5,n1=0;
bool test= true;
if(test)
{
n=n/n1;
}
}
catch(const char* msg){
}
推荐答案
请参见此处: c ++ - 捕获异常:除以零 - 堆栈溢出 [ ^ ]。
请注意,即使浮动异常可以被捕获,您的代码也无法正确处理它,因为异常会根据其类型被捕获。
See for instance here: c++ - Catching exception: divide by zero - Stack Overflow[^].
Please note, even if floating exception would have been catchable, your code would not correctly handle it, because exceptionare caught based on their type.
这篇关于C ++尝试catch不处理错误。应用程序继续崩溃。在WINCE上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文