宏很有用, 小心别上瘾.
1. Stringification, 把参数作为C字符串, "#".
#define M(a) #a
M(hello) => "hello"
2. Concatenation, 字面替换和拼接, "##".
#define M(a) a ## _b
M(hello) => hello_b
## 两边可以放空白字符和注释.
参考: Red Hat Enterprise Linux 3: Using cpp, the C Preprocessor
宏很有用, 小心别上瘾.
1. Stringification, 把参数作为C字符串, "#".
#define M(a) #a
M(hello) => "hello"
2. Concatenation, 字面替换和拼接, "##".
#define M(a) a ## _b
M(hello) => hello_b
## 两边可以放空白字符和注释.
参考: Red Hat Enterprise Linux 3: Using cpp, the C Preprocessor