Derive-C
Loading...
Searching...
No Matches
panic.h File Reference
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
Include dependency graph for panic.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define PANIC(...)
#define ASSERT(expr, ...)
#define DEBUG_ASSERT(expr)

Macro Definition Documentation

◆ ASSERT

#define ASSERT ( expr,
... )
Value:
if (!(expr)) { \
PANIC("assertion " #expr " failed: " __VA_ARGS__ "\n"); \
}
Examples
structures/hashmap.c.

Definition at line 16 of file panic.h.

16#define ASSERT(expr, ...) \
17 if (!(expr)) { \
18 PANIC("assertion " #expr " failed: " __VA_ARGS__ "\n"); \
19 }

◆ DEBUG_ASSERT

#define DEBUG_ASSERT ( expr)
Value:
ASSERT(expr)
#define ASSERT(expr,...)
Definition panic.h:16

Definition at line 23 of file panic.h.

◆ PANIC

#define PANIC ( ...)
Value:
do { \
fprintf(stderr, __VA_ARGS__); \
abort(); \
} while (0);

Definition at line 8 of file panic.h.

8#define PANIC(...) \
9 do { \
10 fprintf(stderr, __VA_ARGS__); \
11 abort(); \
12 } while (0);