Skip to content

Instantly share code, notes, and snippets.

@yspkm
Created March 29, 2023 12:28
Show Gist options
  • Save yspkm/17e4930910cb936c9151a8d0cdb5289f to your computer and use it in GitHub Desktop.
Save yspkm/17e4930910cb936c9151a8d0cdb5289f to your computer and use it in GitHub Desktop.
디버깅용 커스텀 매크로
#include <stdio.h>
#include <stdlib.h>
#define assert(expr) do { \
if (!(expr)) { \
fprintf(stderr, "Assertion failed: %s:%d: %s\n", __FILE__, __LINE__, #expr); \
exit(EXIT_FAILURE); \
} \
} while(0)
#define panic(msg) do { \
fprintf(stderr, "panic: %s:%d: %s\n", __FILE__, __LINE__, msg); \
exit(EXIT_FAILURE); \
} while(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment