一、
头文件:
#define debug 1
#if debug
#define dbg_print(format,args...)\
do\
{\
printf("[%s][%d]"format,__FUNCTION__, __LINE__,## args);\
}while(0)
#else
#define dbg_print(format,args...)
#endif
#define dbg_print(format,args...)\
do\
{\
printf("[%s][%d]"format,__FUNCTION__, __LINE__,## args);\
}while(0)
#else
#define dbg_print(format,args...)
#endif
c文件中使用:
dbg_print("para is NULL");
dbg_print("value(%d) is err", value);
二、
》》头文件《《
/* 调试打印 */
#define DEBUG 0
#if DEBUG
#define DebugPrintval(x) \
printf("[%s]%s:%d:%s=%d\n", __FILE__, __FUNCTION__, __LINE__, #x, x)
#define DEBUG 0
#if DEBUG
#define DebugPrintval(x) \
printf("[%s]%s:%d:%s=%d\n", __FILE__, __FUNCTION__, __LINE__, #x, x)
#define DebugPrintStr(x) \
printf("
printf("