- Qt 6.9
- Qt Core
- Obsolete Members for <QtAssert>
- Qt 6.9.3 Reference Documentation

# 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().