C preprocessor, recursive macros

前端 未结 3 1452
别跟我提以往
别跟我提以往 2020-12-14 03:14

Why does M(0) and N(0) have different results?

#define CAT_I(a, b) a ## b
#define CAT(a, b) CAT_I(a, b)

#define M_0 CAT(x, y)
#define M_1 whatever_else
#de         


        
3条回答
  •  一个人的身影
    2020-12-14 03:58

    There seems to be something that you might have failed to spot but your macro has N(a) CAT(N_,a)(), whereas M(a) is defined as CAT(M_, a) Notice the extra parameter brackets used....

提交回复
热议问题