diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-09-14 01:26:47 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-09-14 01:26:47 +0900 |
| commit | 49b139c339cd1a4cb3a8fc817a582ec6af6c3ca4 (patch) | |
| tree | bac6eda05c1a02f7df7eca4e1265cf1b896bafed /include | |
| parent | 6a45ad108293f9fa4f90eed55fc1101711bcc0ee (diff) | |
| download | ducc-49b139c339cd1a4cb3a8fc817a582ec6af6c3ca4.tar.gz ducc-49b139c339cd1a4cb3a8fc817a582ec6af6c3ca4.tar.zst ducc-49b139c339cd1a4cb3a8fc817a582ec6af6c3ca4.zip | |
feat: include <assert.h>
Diffstat (limited to 'include')
| -rw-r--r-- | include/assert.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/assert.h b/include/assert.h new file mode 100644 index 0000000..aac81d7 --- /dev/null +++ b/include/assert.h @@ -0,0 +1,16 @@ +#ifndef __DUCC_BUILTIN___ASSERT_H__ +#define __DUCC_BUILTIN___ASSERT_H__ + +#ifdef NDEBUG +#define assert(x) ((void)0) +#else +#define assert(x) \ + do { \ + if (!(x)) { \ + fprintf(stderr, "%s:%d: assertion failed.\n", __FILE__, __LINE__); \ + abort(); \ + } \ + } while (0) +#endif + +#endif |
