Can i use "try catch" in app?
I try to write a simple example ,in app I use "try catch" but unsuccess?
Can i help you?
Can i use "try catch" in app?
I try to write a simple example ,in app I use "try catch" but unsuccess?
Can i help you?
Show us what you tried so far.
i tried
Qt Code:
int t =1; int t1 = 0; try { float t2 = t/t1; } catch (...) { qDebug()<<"test"; }To copy to clipboard, switch view to plain text mode
and what happens?
app is wrong. why try catch do not active?
what means "app is wrong"?
app is quit and it does not run command "Qdebug()<<"test"
What compiler are you using? I think in some cases, the compiler doesn't generate an exception
Division by zero doesn't throw an exception in Standard C++.
if Qt does not catch exceptions, it will crashes...
so, does Qt catch exceptions anywhere?
what does Qt have to do with this? it's c++ that does not throw an exception in this case, as helloworld stated.
you can use try...catch in your qt app. you can catch exceptions. but you can't catch exceptions that are never thrown...
Bookmarks