来自: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! "); PR("hello world! "); PR("string:%s ", "data"); PR("integer:%d ", 100); return 0; }