Skip to content

Instantly share code, notes, and snippets.

@SilverRainZ
Created September 4, 2015 04:40
Show Gist options
  • Save SilverRainZ/a0d29aafcd939ec475f9 to your computer and use it in GitHub Desktop.
Save SilverRainZ/a0d29aafcd939ec475f9 to your computer and use it in GitHub Desktop.
printl
// printl.c
#ifdef DEBUG
inline void printl(const char *fmt, ...){ \
char buf[256]; \
va_list args; \
int i; \
\
memset(buf, 0, sizeof(buf)); \
va_start(args, fmt); \
vsprintk(buf, fmt, args); \
va_end(args); \
for (i = 0; i < strlen(buf); i++){ \
bochs_putc(buf[i]); \
}
#else
inline void printl(const char *fmt, ...){}
#endif
// printl.h
inline void printl(const char *fmt, ...);
// call
#define DEBUG 1
printl("aaa");
#undef DEBUG
printl("bbb");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment