問題:
Trying to create a macro which can be used for print debug messages when DEBUG is defined, like the following pseudo code:嘗試創建可用於在定義 DEBUG 時打印調試消息的宏,如下面的僞代碼:
#define DEBUG 1
#define debug_print(args ...) if (DEBUG) fprintf(stderr, args)
How is this accomplished with a macro?這是如何通過宏實現的?
解決方案:
參考一: https://stackoom.com/question/6tu8參考二: #define macro for debug printing in C?