Last active
December 15, 2015 11:09
-
-
Save thachhoang/5250835 to your computer and use it in GitHub Desktop.
Revisions
-
thachhoang revised this gist
Mar 27, 2013 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ #include <stdio.h> #include <stdlib.h> #include <stdarg.h> /* va_start, va_end */ #define DEBUG 0 -
thachhoang created this gist
Mar 27, 2013 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ #include <stdio.h> #include <stdarg.h> /* va_start, va_end */ #define DEBUG 0 void fail(const char *, ...); void ftrace(FILE *, const char *, ...); void trace(const char *, ...); void fail(const char *fmt, ...) { // Error message va_list args; va_start(args, fmt); vfprintf(stderr, fmt, args); va_end(args); fprintf(stderr, ".\n"); exit(EXIT_FAILURE); } void ftrace(FILE *stream, const char* fmt, ...){ if(!DEBUG) return; va_list args; va_start(args, fmt); vfprintf(stream, fmt, args); va_end(args); } void trace(const char* fmt, ...){ if(!DEBUG) return; va_list args; va_start(args, fmt); vfprintf(stdout, fmt, args); va_end(args); }