pulsatrix
Loading...
Searching...
No Matches
assert.hpp File Reference

PULSATRIX_ASSERT – debug-only invariant check for programmer errors, distinct from throw (used for caller-facing contract violations). See cpp_style_guide/context_style_project_conventions.md's assert-vs-throw table. More...

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

Go to the source code of this file.

Macros

#define PULSATRIX_ASSERT(cond)
 Aborts with a diagnostic message if cond is false. Debug-only – use for conditions that indicate a bug in this library's own code (a caller violating a documented precondition), never for conditions a well-formed external caller can legitimately trigger (use throw for those instead).
 

Detailed Description

PULSATRIX_ASSERT – debug-only invariant check for programmer errors, distinct from throw (used for caller-facing contract violations). See cpp_style_guide/context_style_project_conventions.md's assert-vs-throw table.

Macro Definition Documentation

◆ PULSATRIX_ASSERT

#define PULSATRIX_ASSERT (   cond)
Value:
do { \
if (!(cond)) { \
std::fprintf(stderr, "PULSATRIX_ASSERT failed: %s at %s:%d\n", #cond, __FILE__, __LINE__); \
std::abort(); \
} \
} while (0)

Aborts with a diagnostic message if cond is false. Debug-only – use for conditions that indicate a bug in this library's own code (a caller violating a documented precondition), never for conditions a well-formed external caller can legitimately trigger (use throw for those instead).