|
dune-common 2.11
|
Provide the macro DUNE_ASSUME(...) that is a portable assume expression as a hint for the compiler/optimizer. If no equivalent to the assume attribute is available, it falls back to an assert() macro. More...
#include <cassert>Go to the source code of this file.
Macros | |
| #define | DUNE_ASSUME(...) |
Provide the macro DUNE_ASSUME(...) that is a portable assume expression as a hint for the compiler/optimizer. If no equivalent to the assume attribute is available, it falls back to an assert() macro.
A detailed explanation of portable assumptions is provided in the C++ standard proposal https://wg21.link/p1774r8.
Caution: Only use simple boolean expressions inside the DUNE_ASSUME macro. Especially, do not use expressions with side effects. Those could result in compiler-dependent behavior.
The implementation is inspired by https://stackoverflow.com/questions/63493968/reproducing-clangs-builtin-assume-for-gcc
| #define DUNE_ASSUME | ( | ... | ) |