[Interest] QT_NO_EXCEPTIONS
Alex Merry
kde at randomguy3.me.uk
Mon Jan 20 13:21:14 CET 2014
[It is possible this belongs more on the development list, but I thought
I'd play safe and post it here first]
Qt uses a QT_NO_EXCEPTIONS preprocessor macro to decide whether to
enable various exception-related code, both in headers and in its source
code.
qmake defines QT_NO_EXCEPTIONS if and only if you tell it to disable
exceptions *for your application* (regardless of whether Qt itself was
compiled with exceptions).
When compiling with GCC, qglobal.h will also define QT_NO_EXCEPTIONS if
-fno-exceptions was passed.
This means that QT_NO_EXCEPTIONS matches whether the user of Qt is being
compiled with exceptions, rather than Qt itself, and so the headers may
not always match the library code. An obvious example is that you may
end up with QException declared but not defined, and various
header-defined methods of, say, QFutures look like they could call the
potentially-undefined QFutureInterfaceBase::reportException.
So my question: is this sane/intended behaviour? Or am I missing something?
I mainly ask because we currently mess with the QT_NO_EXCEPTIONS define
in the standard CMake setup for KDE software, and I have a suspicion
that both we and qmake are Doing It Wrong.
Alex
More information about the Interest
mailing list