I'm taking a look at an application that defines a large set of constant arrays. What really confuses me is the use of two pound signs next to each other in a macro. For example:
#define r0(p,q,r,s) 0x##p##q##r##s
What do those two pound signs mean?
##
提供了一种在宏扩展期间连接实际参数的方法。
##
concattenates symbols. So for example if the value of p
is ab
, 0x##p
would become 0xab
.
Als and sepp2k give correct answer.
However I would like to add, that this macro seems to be completely unnecessary.
unsigned int value = r0(b,e,a,f);
can be replaced by better and shorter:
unsigned int value = 0xbeaf;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.