EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
Macros
EBGeometry_Macros.hpp File Reference

Utility macros for EBGeometry. More...

#include <cstdio>
#include <cstdlib>
Include dependency graph for EBGeometry_Macros.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define EBGEOMETRY_EXPECT(cond)   ((void)(cond))
 Runtime precondition assertion for EBGeometry.
 

Detailed Description

Utility macros for EBGeometry.

Author
Robert Marskar

Macro Definition Documentation

◆ EBGEOMETRY_EXPECT

#define EBGEOMETRY_EXPECT (   cond)    ((void)(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 still evaluates the condition (to suppress "unused variable" warnings from variables that appear only inside assertions) but the result is discarded at zero runtime cost.

Enabling assertions
# CMake
target_compile_definitions(MyTarget PRIVATE EBGEOMETRY_ENABLE_ASSERTIONS)
# GNU Make
CXXFLAGS += -DEBGEOMETRY_ENABLE_ASSERTIONS
# Command line
g++ -DEBGEOMETRY_ENABLE_ASSERTIONS ...
Parameters
condBoolean-convertible expression to test.