Obsolete Members for <QtAssert>
<QtAssert> 类的以下成员已被废弃。提供这些成员是为了确保旧源代码能够继续运行。我们强烈建议不要在新代码中使用它们。
宏
(deprecated in 6.6) void | Q_ASSUME(bool expr) |
宏文档
[deprecated in 6.6] void Q_ASSUME(bool expr)
自 6.6 版本起,此宏已被废弃。我们强烈建议不要在新代码中使用它。
该宏会导致编译器假设 `expr ` 等同于 `true`。
已知在某些编译器版本中,使用此宏生成的代码质量会比未插入该假设时更差。在某些编译器中(而非所有编译器),传递给该宏的参数始终会被求值,即使在发布模式下也是如此;因此,应用程序代码需要注意这些可能存在的行为差异。
请勿在新代码中使用它。该宏为兼容旧代码而保留,但很可能在 Qt 的下一个主要版本中被移除。
另请参阅 Q_ASSERT()、Q_UNREACHABLE()、Q_LIKELY() 以及Q_PRESUME()。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.