From the same document:
It does nothing if QT_NO_DEBUG was defined at compile time.
So think about it: Q_ASSERT is independent of the absence of NDEBUG , because assert is. #ifndef NDEBUG is required for assert() to do something, and is also often used to demarcate other common debugging properties only in the user code (and possibly in the library ..?).
Using a separate macro is an advantage for those who want to debug only Qt related things without leaving NDEBUG undefined and thus weighing the rest of the code with debugging materials that inflate if NDEBUG not defined, especially assert() s.
So, you can compile with -DNDEBUG , but not -DQT_NO_DEBUG if you want to compile βnormalβ things using release mode semantics, but at the same time apply debugging to Qt materials.
This is very useful when developing a complex GUI application. I do not use Qt (yet?), But I see the advantage of using such things in my selected GTK + / gtkmm tools [... which, I am sure, exist, but I have not looked at them yet ;-)]
I recall a recent animated discussion about this here, intertwined with a discussion of an orthogonal proposal: ISO C ++ Standard - Future Suggestions> Trace Information for the Exception Stack.
underscore_d
source share