Quantcast
Channel: 睿论坛 - 最新话题
Viewing all articles
Browse latest Browse all 5702

Objective-C里面局部静态变量指向的常量字符串为啥不存在与cfstring节呢?

$
0
0

@SatanWoo1 wrote:

- (void)viewDidLoad {
    [super viewDidLoad];
    
    static NSString *haha = @"hehehehe";


    NSLog(@"static");
    // Do any additional setup after loading the view, typically from a nib.
}

如上述代码所示,很简单的iOS模版工程。局部变量、全局变量(无论是非静态)指向的常量字符串都会出现在__DATA段的CFString节里,但是用machoview或者hopper都看不到hehehe,能看到static。

环境是在DEBUG下,而且为了避免优化,还实验了__attribute__((used))来避免符号被去除。

请问有人知道吗?谢谢~

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 5702

Trending Articles