Obsolete Members for <QtAssert>

The following members of class <QtAssert> are deprecated. They are provided to keep old source code working. We strongly advise against using them in new code.

Macros

(deprecated) void Q_ASSUME(bool expr)

Macro Documentation

[deprecated] void Q_ASSUME(bool expr)

This macro is deprecated. We strongly advise against using it in new code.

Causes the compiler to assume that expr is true.

This macro is known to produce worse code than when no assumption was inserted in the code, with some compiler versions. The arguments passed to it are always evaluated, even in release mode, with some compilers and not others, so application code needs to be aware of those possible differences in behavior.

Do not use it in new code. It is retained as-is for compatibility with old code and will likely be removed in the next major version Qt.

See also Q_ASSERT(), Q_UNREACHABLE(), and Q_LIKELY().

© 2025 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.