在C ##运营商 [英] The ## operator in C
本文介绍了在C ##运营商的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是什么 ##
做用C?
例如:
typedef struct
{
unsigned int bit0:1;
unsigned int bit1:1;
unsigned int bit2:1;
unsigned int bit3:1;
unsigned int bit4:1;
unsigned int bit5:1;
unsigned int bit6:1;
unsigned int bit7:1;
} _io_reg;
#define REGISTER_BIT(rg,bt) ((volatile _io_reg*)&rg)->bit##bt
(我知道这一切确实除了##部分)。
(I know what it all does besides the ## part.)
推荐答案
有字符串连接,为preprocessor宏的一部分。
It is string concatenation, as part of the preprocessor macro.
(在此背景下,串是指课程的preprocessor标记或来源$ C $ C字符串,且的不的一个C字符串。)
(In this context, "string" refers to a preprocessor token of course, or a "string of source code", and not a C-string.)
这篇关于在C ##运营商的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文