ndtree
nd-octree data-structure and algorithms
assert.hpp File Reference

Assert macro. More...

Macros

#define NDTREE_ASSUME(cond)
 Tells the optimizer that it can assume that the condition is true.
 
#define NDTREE_ASSERT_AT(condition, message, AT, ...)
 Asserts a condition in DEBUG mode. Useful for checking pre/postconditions and invariants. More...
 

Detailed Description

Assert macro.

Macro Definition Documentation

#define NDTREE_ASSERT_AT (   condition,
  message,
  AT,
  ... 
)
Value:
do { \
if (NDTREE_UNLIKELY(!(condition))) { \
::ndtree::fmt::print( \
stderr, \
"\nASSERTION FAILED:\n\n condition: \"{}\"\n message: \"" message \
"\"\n\n", \
#condition, ##__VA_ARGS__); \
__builtin_debugtrap(); \
} \
NDTREE_ASSUME((condition)); \
} while (false)
#define NDTREE_PRINT_AT(AT)
Formats a source code location.
Definition: at.hpp:31
#define NDTREE_ASSUME(cond)
Tells the optimizer that it can assume that the condition is true.
Definition: assert.hpp:13

Asserts a condition in DEBUG mode. Useful for checking pre/postconditions and invariants.

Warning
if NDTREE_DISABLE_ASSERTIONS is defined the condition in the if clause is always false and NDTREE_ASSERT compiles to nothing! Still this happens after the compiler has verified the correctness of the NDTREE_ASSERT code.