Frage

Qt has Q_ASSERT, which is the equivalent of MFC ASSERT(), but MFC also has the VERIFY() macro, which behaves the same as ASSERT() in Debug, except for Release:

In the Release version of MFC, VERIFY evaluates the expression but does not print or interrupt the program. For example, if the expression is a function call, the call will be made.

Does Qt have an equivalent for VERIFY()?

War es hilfreich?

Lösung

It is missing in Qt, but it should be easy to make your own:

#if !defined(VERIFY)
# if !defined(QT_NO_DEBUG)
#  define VERIFY Q_ASSERT
# else
#  define VERIFY(expr)  \
    do                    \
    {                     \
        (void) (expr);    \
    } while (0)
# endif
#endif
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top