PDA

View Full Version : Qt and exception support....



sergey_85
28th November 2009, 11:15
Hi!

I'am build application for MacOS, Windows and Linux.

In my code I use exceptions (c++ standart), but in Qt I not found exception anywhere, only error code and true|false returning.

May be some OS not support exception? ... and why Qt framework don't use exceptions?

Thanks.

squidge
28th November 2009, 12:17
Qt does uses exceptions (hence QT_NO_EXCEPTIONS definition), but not very many of them.

Personally, I prefer to do without them unless I find it's necessary to do a cleanup if the function fails. I would hate to have to litter my code with "try...catch" in case a Qt function threw an exception. A return code is more friendlier, and you can then decide for yourself whether or not to turn it into an exception.