Skip to content

Instantly share code, notes, and snippets.

@voldyman
Created December 15, 2018 17:03
Show Gist options
  • Save voldyman/c112d7b07c712cd60bddb1b0d8053c7d to your computer and use it in GitHub Desktop.
Save voldyman/c112d7b07c712cd60bddb1b0d8053c7d to your computer and use it in GitHub Desktop.
#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