用宏定义代替printf函数
来自:http://blog.csdn.net/yannanxiu/article/details/52506451
#define _DEBUG_ 1 #if _DEBUG_ #define PR(...) printf(__VA_ARGS__) #else #define PR(...) #endif
代码:
#include "stdafx.h" #define _DEBUG_ 1 #if _DEBUG_ #define PR(...) printf(__VA_ARGS__) #else #define PR(...) #endif int _tmain(int argc, _TCHAR* argv[]) { printf("debug test!\r\n"); PR("hello world!\r\n"); PR("string:%s\r\n", "data"); PR("integer:%d\r\n", 100); return 0; }