# 和 ## 宏运算符
# 代表将标记转换成字符串。
如#define A(token) #token
A(hello)就是"hello"
注意,这里也可以跟字符串拼接。
如#define A(token) "hello "#token
A(world)就是"hello ""world"即"hello world"
## 代表将两边标记连接成一个标记。
如#define A(token) test_##token
A(hello)就是test_hello (注意这里不再是字符串)
参考链接:
http://www.cprogramming.com/tutorial/cpreprocessor.html
http://www.cprogramming.com/reference/preprocessor/token-pasting-operator.html
浙公网安备 33010602011771号