[Qt-interest] How to handle exceptions in Qt
David Ching
dc at remove-this.dcsoft.com
Thu Dec 17 20:18:01 CET 2009
"Thiago Macieira" <thiago at kde.org> wrote in message
news:200912162339.46953.thiago at kde.org...
> I think that Windows does have an exception mechanism that can be caught
> by
> catch (...). Most people who use exceptions don't like that behaviour
> because
> it breaks exception handling.
The catch(...) only catches "structured exceptions" like divide by 0 and
NULL pointer dereference if you build with /EHa (this is assuming VC++,
don't know about gcc). This is not recommended as it bloats code as well as
not working very well in general. Instead it is recommended you build with
no exception handling or with /EHs or /EHsc, which enables traditional C++
exceptions only. In addition to this, you can set a global handler for
structured exceptions using SetUnhandledExceptionHandler() and
AddVectoredExceptionHandler().
-- David
More information about the Qt-interest-old
mailing list