#define 宏用於 C 中的調試打印? - #define macro for debug printing in C?

問題:

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?
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章