Function macro definitions accept two special operators (# and ##) in the replacement sequence:
If the operator # is used before a parameter is used in the replacement sequence, that parameter is replaced by a string literal (as if it were enclosed between double quotes)
1 2 |
|
|
The operator ## concatenates two arguments leaving no blank spaces between them:
1 2 |
|
|
即
#x表示给x加上双引号
x##y表示x连接y
在查找特殊字符的同时,还发现了有的blog中提到了#@和\,比如你也许不知道的#define用法中就提到了:
#@x是给x加上单引号“'”
#define ToChar(x) #@x
char a = ToChar(1),就是a='1'
而\则很简单,类似于shell中的命令,可以用"\"表示下一行继续此宏的定义。
No comments:
Post a Comment