c - printf macro for compiler with and without support for VARIADIC -


please me writing printf macro 1 compiler supports variadic , not.

for instance:

#ifdef have__va_args   printf macro   #else   printf macro  

an solution variadic can lock this.

#define my_printf(_format, ...) { \         printf(_format, __va_args__); \     } 

and if have compiler without variadic, have implement function variable argument list.

#include <stdarg.h> #include <std.h> int my_printf(const char *format, ...) {   va_list ap;   va_start(ap, dst);   return vprintf(format, ap); } 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -