View Full Version : QT and exceptions

25th January 2006, 14:27
I've come to understand that Qt does not use exceptions. Why?

25th January 2006, 14:35
Somewhere the docs state that exceptions are not supported correctly by all compilers Qt wants to support. Another problem is that exceptions are not safe to use across "compiler boundaries".
But you may use exceptions whereever you want in your Code - they'll just pass right through the Qt code.

25th January 2006, 14:37
What about bad_alloc?

25th January 2006, 14:44
I also haven't found a reliable answer but you could also see a very intresting discussion in the qt-intrest mailing list: http://lists.trolltech.com/qt-interest/2002-12/thread00054-0.html

25th January 2006, 15:05
What about bad_alloc?
I've grepped through the code: They use new(nothrow). At least in some places they use placement new. But I have no idea whether they do it everywhere...

My grep also showed that at critical places in the code they catch all exceptions to clean up and then throw it again.