这是什么意思##为C(C ++)preprocessor? [英] What does ## mean for the C(C++) preprocessor?
本文介绍了这是什么意思##为C(C ++)preprocessor?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个 C 以下程序:
#define f(g,g2) g##g2
main()
{
int var12=100;
printf("%d",f(var,12));
}
当我运行只是preprocessor它扩展这是
when I run just the preprocessor it expands this as
{
int var12=100;
printf("%d",var12);
}
这就是为什么输出为100的原因。
which is the reason why the output is 100.
有人能告诉我如何/为何preprocessor扩张 VAR ## 12 var12
?
Can anybody tell me how/why the preprocessor expands var##12 to var12
?
推荐答案
什么太花哨: ##
讲述了preprocessor来连接的左右两侧
nothing too fancy: ##
tells the preprocessor to concatenate the left and right sides
看<一个href=\"http://en.wikipedia.org/wiki/C_$p$pprocessor#Token_concatenation\">http://en.wikipedia.org/wiki/C_$p$pprocessor#Token_concatenation
这篇关于这是什么意思##为C(C ++)preprocessor?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文