Derive-C
Loading...
Searching...
No Matches
panic.h File Reference
#include <assert.h>
#include <stdio.h>
#include <stdlib.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 15 of file panic.h.

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

◆ DEBUG_ASSERT

#define DEBUG_ASSERT ( expr)

Definition at line 24 of file panic.h.

◆ PANIC

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

Definition at line 7 of file panic.h.

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