作者:刘昊昱
博客:http://blog.csdn.net/liuhaoyutz
#include <stdio.h> #define HAOYU_DEBUG_TYPE #ifdef HAOYU_DEBUG_TYPE #define HAOYU_DEBUG(...) do { printf(" [HAOYU_DEBUG] ------------------ in %s:%d %s()------------------ ", __FILE__, __LINE__, __FUNCTION__); printf(__VA_ARGS__); printf(" "); } while(0); #else #define HAOYU_DEBUG(...) do {} while(0) #endif int main(int argc, char **argv) { int i = 0; printf("hellodebug! "); HAOYU_DEBUG("debug message, i = %d", i); return 0; }