#if TARGET_OS != LINUX #error "This code only supports Linux!" #endif
遇到#error編譯器立即停止,輸出錯誤信息。用於編譯期配置檢查。
# define(#與define有空格)合法,#不必在行首#define sizeof合法(遮蔽關鍵字),#define int非法#if 0...#endif常用於代碼塊級註釋z = 4 // 編譯時輸出:note: #pragma message: _RUN macro activated!
#define開始,#undef/文件結束結束#error阻斷編譯,#pragma message僅提示#pragma message管理複雜宏配置