NSString *str = @"123";
NSString *str2 = [NSString stringWithFormat:@"123"];
这两种声明方式有什么区别?将上面代码 clang -rewrite-objc 变成c++代码。
NSString *str = (NSString *)&__NSConstantStringImpl__var_folders_k8_nvb1mj_10hz6hjz_j35dr4gw0000gn_T_main_52b509_mi_0;
NSString *str2 = ((NSString * _Nonnull (*)(id, SEL, NSString * _Nonnull, ...))(void *)objc_msgSend)((id)objc_getClass("NSString"), sel_registerName("stringWithFormat:"), (NSString *)&__NSConstantStringImpl__var_folders_k8_nvb1mj_10hz6hjz_j35dr4gw0000gn_T_main_52b509_mi_1);
static __NSConstantStringImpl __NSConstantStringImpl__var_folders_k8_nvb1mj_10hz6hjz_j35dr4gw0000gn_T_main_52b509_mi_0 __attribute__ ((section ("__DATA, __cfstring"))) = {__CFConstantStringClassReference,0x000007c8,"123",3};
static __NSConstantStringImpl __NSConstantStringImpl__var_folders_k8_nvb1mj_10hz6hjz_j35dr4gw0000gn_T_main_52b509_mi_1 __attribute__ ((section ("__DATA, __cfstring"))) = {__CFConstantStringClassReference,0x000007c8,"123",3};
(section ("__DATA, __cfstring")在可执行文件中
ios可执行文件图.jpg
网友评论