EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
Source
EBGeometry_Macros.hpp
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: 2026 Robert Marskar <robert.marskar@sintef.no>
2
//
3
// SPDX-License-Identifier: GPL-3.0-or-later
4
11
#ifndef EBGEOMETRY_MACROS_HPP
12
#define EBGEOMETRY_MACROS_HPP
13
14
#include <cstdio>
15
#include <cstdlib>
16
51
#if defined(EBGEOMETRY_ENABLE_ASSERTIONS)
52
#define EBGEOMETRY_EXPECT(cond) \
53
do { \
54
if (!(cond)) { \
55
std::fprintf(stderr, \
56
"EBGeometry assertion failed: (%s)\n file: %s\n line: %d\n function: %s\n", \
57
#cond, \
58
__FILE__, \
59
__LINE__, \
60
static_cast<const char*>(__func__)); \
61
std::abort(); \
62
} \
63
} while (0)
64
#else
65
// Unevaluated sizeof: cond is parsed (syntax-checked, names count as "used") but never evaluated,
66
// so disabled assertions have exactly zero runtime cost and cannot have observable side effects.
67
#define EBGEOMETRY_EXPECT(cond) (static_cast<void>(sizeof((cond))))
68
#endif
69
70
#endif
// EBGEOMETRY_MACROS_HPP
Generated by
1.9.8