What is wrong with this Macro?

后端 未结 1 814
-上瘾入骨i
-上瘾入骨i 2021-01-14 23:10
#define mySynthesize(op) @synthesize op = _op;

So rather than typing

@synthesize someVar=_someVar;
@synthesize otherVar=_otherVar;
         


        
相关标签:
1条回答
  • 2021-01-14 23:34

    When you prefix the op with an underscore, the preprocessor treats it as a different token, so it doesn't get replaced. You need to use ## to concatenate the underscore to the front so that the replacement occurs first.

    #define mySynthesize(op) @synthesize op = _ ## op
    
    0 讨论(0)
提交回复
热议问题