陌生的宏观扩张 [英] Unfamiilar macro expansion
本文介绍了陌生的宏观扩张的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我对std #defines和min max函数的宏扩展很熟悉,但是这一点让我感到震惊.特别是定义中的#.您的想法表示赞赏.
I am familiar with std #defines and macro expansion for min max function but this one throws me. In particular the #'s in the definition. Your thoughts appreciated.
#define TAB_WIDGET_ROW(t) {t##_seq, t##_len, t##_rep}
推荐答案
##
是用于连接的C预处理程序标准宏.
The ##
is a C preprocessor standard macro used for concatenation.
这样,代码:
#define TAB_WIDGET_ROW(t) {t##_seq, t##_len, t##_rep}
int foo[3] = TAB_WIDGET_ROW(bar);
将扩展为:
int foo[3] = {bar_seq, bar_len, bar_rep};
并且 foo
数组将填充变量 bar_seq
, bar_len
和 bar_rep
的值.
And the foo
array will be filled with values of variables bar_seq
, bar_len
and bar_rep
.
有关更多信息,请参见此处.
See here for more informations.
这篇关于陌生的宏观扩张的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文