Qt 有 Q_ASSERT
,它相当于 MFC ASSERT()
,但 MFC 也有 VERIFY()宏,其行为与调试中的 ASSERT()
相同,但发布除外:
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.
Qt 是否有 VERIFY() 的等效项?
最佳答案
它在 Qt 中缺失,但应该很容易制作您自己的:
#if !defined(VERIFY)
# if !defined(QT_NO_DEBUG)
# define VERIFY Q_ASSERT
# else
# define VERIFY(expr) \
do \
{ \
(void) (expr); \
} while (0)
# endif
#endif
关于c++ - Qt 中是否有与 MFC VERIFY() 等效的函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18712810/