[Interest] Survey: do you override QCoreApplication::notify? Why?

Thiago Macieira thiago.macieira at intel.com
Fri Apr 17 17:37:00 CEST 2015


On Friday 17 April 2015 17:27:39 Guido Seifert wrote:
> > It prints the exception type to stderr. If you want to log something
> > different, install a different terminate handler.
> 
> Does this work? I don't see how a terminate handler gets the thrown object.

There's a function to get the current exception somewhere. Please take a look 
at your C++ standard library runtime documentation. I have no need of knowing 
which functions those are and how they operate because I don't use exceptions, 
so I can't help further.

> A terminate handler takes no parameter and returns void. I am using notify
> only with use case 1. During development when I implement an exception, but
> are too lazy to do the exception handling immediately. The exception gets a
> 'FIXME:', which is nicely shown in QtC. If it is against my expectations
> thrown, a log output from notify shows me where and why it was thrown.
> Before release the FIXMEs are fixed and the try/catch around notify does
> not matter anymore. I could live without it, but find it very convenient.

You don't need a log output for that. If you don't catch the exception, it 
will cause the application to terminate (with a core dump, if you have that 
enabled), so you can not only get the exception name, you get the exact 
backtrace of how you got there and the state of the variables leading to the 
throwing.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list