XIEITE_DEBUG

Defined in header <xieite/debug.hpp>
(header-only: <xieite/pp/debug.hpp>)


Detects the presence of platform-specific macros indicating debug mode: DEBUG, NDEBUG, _DEBUG, and QT_DEBUG.


Definition

#define XIEITE_DEBUG /* 0 or 1 */


Example

#include <xieite/debug.hpp>
import xieite;

int add(int a, int b) {
	if constexpr (XIEITE_DEBUG) {
		std::print("Adding {} and {}\n", a, b);
	}
	return a + b;
}

int main() {
	int sum = add(1, 2);
	std::print("Result: {}\n", sum);
}
Possible output:
Adding 1 and 2
Result: 3
View in Compiler Explorer