Created
March 29, 2023 12:28
-
-
Save yspkm/17e4930910cb936c9151a8d0cdb5289f to your computer and use it in GitHub Desktop.
디버깅용 커스텀 매크로
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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