|
EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
|
Utility macros for EBGeometry. More...
#include <cstdio>#include <cstdlib>

Go to the source code of this file.
Macros | |
| #define | EBGEOMETRY_EXPECT(cond) (static_cast<void>(sizeof((cond)))) |
| Runtime precondition assertion for EBGeometry. | |
Utility macros for EBGeometry.
| #define EBGEOMETRY_EXPECT | ( | cond | ) | (static_cast<void>(sizeof((cond)))) |
Runtime precondition assertion for EBGeometry.
When EBGEOMETRY_ENABLE_ASSERTIONS is defined (e.g. via -DEBGEOMETRY_ENABLE_ASSERTIONS on the compiler command line, in CXXFLAGS for GNU Make, or via CMake's target_compile_definitions), this macro evaluates cond and, if it is false, prints a diagnostic message to stderr and calls std::abort().
When EBGEOMETRY_ENABLE_ASSERTIONS is not defined the macro does not evaluate the condition at all: it expands to a discarded sizeof, which is an unevaluated context. The expression is therefore never executed (guaranteed zero runtime cost and no side effects, even at -O0), yet is still parsed – so it stays syntax-checked and any variables/parameters that appear only inside assertions are still considered "used" and do not trigger unused-entity warnings.
| cond | Boolean-convertible expression to test. |