سؤال

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

هل كانت مفيدة؟

المحلول

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
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top