Created
December 15, 2018 17:03
-
-
Save voldyman/c112d7b07c712cd60bddb1b0d8053c7d 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 <stdarg.h> | |
#define DEBUG | |
#ifdef DEBUG | |
#define DEBUG_MSG(fmt, ...) print_debug(fmt, ##__VA_ARGS__) | |
#else | |
#define DEBUG_MSG(fmt, args...) ((void) 0) | |
#endif | |
void print_debug(const char* fmt, ...) { | |
va_list args; | |
va_start(args, fmt); | |
vfprintf(stderr, fmt, args); | |
va_end(args); | |
fprintf(stderr, "\n"); | |
fflush(stderr); | |
} | |
int main() { | |
DEBUG_MSG("Test message"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment