Update to readme and added UNREACHABLE and TODO macros

Author Mitja Felicijan <mitja.felicijan@gmail.com> 2026-01-23 00:02:07 +0100
Committer Mitja Felicijan <mitja.felicijan@gmail.com> 2026-01-23 00:02:07 +0100
Commit d0f5be14558e2b0cc506654bd45bb6d81553c456 (patch)
-rw-r--r-- README.md 6
-rw-r--r-- nonstd.h 13
2 files changed, 17 insertions, 2 deletions
diff --git a/README.md b/README.md
...
6
> [!IMPORTANT]
6
> [!IMPORTANT]
7
> There are more involved libraries out there providing better granularity
7
> There are more involved libraries out there providing better granularity
8
> and functionality. This library is intended for ease of use first and
8
> and functionality. This library is intended for ease of use first and
9
> foremost. It is not a replacement for those libraries.
9
> foremost. It is not a replacement for those libraries. Use at your own risk.
10
  
10
  
11
## Features
11
## Features
12
  
12
  
...
220
```bash
220
```bash
221
make test
221
make test
222
```
222
```
  
223
  
  
224
## Acknowledgments
  
225
  
  
226
- https://github.com/tsoding/nob.h
diff --git a/nonstd.h b/nonstd.h
...
60
#define MAX(a, b) ((a) > (b) ? (a) : (b))
60
#define MAX(a, b) ((a) > (b) ? (a) : (b))
61
#define CLAMP(x, lo, hi) (MIN((hi), MAX((lo), (x))))
61
#define CLAMP(x, lo, hi) (MIN((hi), MAX((lo), (x))))
62
  
62
  
63
#define UNUSED(x) (void)(x)
63
// From https://github.com/tsoding/nob.h/blob/e2c9a46f01d052ab740140e74453665dc3334832/nob.h#L205-L206.
  
64
#define UNUSED(value) (void)(value)
  
65
#define TODO(message)                                                      \
  
66
	do {                                                                   \
  
67
		fprintf(stderr, "%s:%d: TODO: %s\n", __FILE__, __LINE__, message); \
  
68
		abort();                                                           \
  
69
	} while (0)
  
70
#define UNREACHABLE(message)                                                      \
  
71
	do {                                                                          \
  
72
		fprintf(stderr, "%s:%d: UNREACHABLE: %s\n", __FILE__, __LINE__, message); \
  
73
		abort();                                                                  \
  
74
	} while (0)
64
  
75
  
65
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
76
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
66
#define STATIC_ASSERT(expr, msg) _Static_assert((expr), msg)
77
#define STATIC_ASSERT(expr, msg) _Static_assert((expr), msg)
...