Banjo API 1.1.0-alpha
Low-level C99 game development API
Loading...
Searching...
No Matches
assert.h File Reference
#include <banjo/api.h>
#include <banjo/log.h>
#include <stdlib.h>
Include dependency graph for assert.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define bj_assert(expr)

Detailed Description

Assertion facility for Banjo API.

Provides the bj_assert macro, similar to the C standard assert(), with behaviour controlled by the build mode of the code that includes it, which follows its NDEBUG (see BJ_BUILD_RELEASE).

  • In debug builds (BJ_BUILD_DEBUG), failed assertions log a fatal error and terminate the process with abort().
  • In release builds (BJ_BUILD_RELEASE), assertions are disabled and compile to a no-op, without evaluating their expression.

Definition in file assert.h.

Macro Definition Documentation

◆ bj_assert

#define bj_assert ( expr)
Value:
((void)0)

Runtime assertion macro.

  • In debug builds, evaluates the given expression and, if it is false, emits a fatal log naming it and terminates the program with abort().
  • In release builds, the macro does nothing and the expression is not evaluated, so its side effects disappear: do not rely on them.
Parameters
exprExpression to check for truth.
Examples
logging.c.

Definition at line 35 of file assert.h.

Referenced by main().