在 ARC 下,我知道“堆栈变量用 nil 初始化”(docs)。静态常量数组的值呢?那是有道理的,但是我找不到官方说明的内容。例如:
static NSString * const strings[5] = {
[2] = @"value2",
[4] = @"value3",
};
将 strings[3]
== nil
吗?
最佳答案
无论ARC如何,根据C语言的定义,静态变量被赋值为NULL/nil/0。
关于objective-c - 使用 ARC,静态常量数组的值是否自动分配为 nil?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10422350/