Domanda

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()?

È stato utile?

Soluzione

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
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top