lsd*_*doy 1 macros objective-c
#define SDNSPredicate(key,value) \
[NSPredicate predicateWithFormat:@"#key == %@",value];
Run Code Online (Sandbox Code Playgroud)
当我使用时SDNSPredicate(@"hCName",@"ccc"),我期待hCName == "ccc"但它变成了key == "ccc"
怎么做对了?
怎么做对吗?
使用功能.宏是邪恶的.
static inline NSPredicate *SDNSPredicate(NSString *key, NSString *value) {
return [NSPredicate predicateWithFormat:@"%@ == %@", key, value];
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
82 次 |
| 最近记录: |