Q_ASSERT
is a custom assert macro which supposedly enhances the standard assert
function.
The error message is handled by qFatal()
, which can behave slightly better on some platforms than the standard assert macro. For example on Windows it will trigger the Visual Studio debugger at the point where the assertion fails instead of just calling abort()
.
You can also redirect the output of Qt error message functions such as qFatal
to your custom message handler ( with qInstallMessageHandler() ). It can be useful for example if you want to redirect the errors message to a file.
Also note that Q_ASSERT
is disabled with the macro QT_NO_DEBUG
(while assert
is disabled by NDEBUG
) : this can be used to separate your asserts between Qt-related code and the rest.