gpt4 book ai didi

c++ - Qt 中是否有 MFC VERIFY() 的等效项?

转载 作者:搜寻专家 更新时间:2023-10-31 01:47:48 25 4
gpt4 key购买 nike

Qt 有Q_ASSERT,相当于MFC ASSERT(),但MFC 也有VERIFY()宏,其行为与 Debug 中的 ASSERT() 相同,但 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.

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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com