【发布时间】:2013-02-20 19:19:04
【问题描述】:
为什么 Apple 的采用 NSError** 的方法不声明为 NSError * __autoreleasing * ?
Transitioning to ARC Release Notes 似乎暗示它们应该是 (?)。
例如,NSFileManager.h 中的所有例程。但我实际上并没有看到 任何 Apple 标头使用了 Transitioning to ARC Release Notes 中的说明:
and the method declaration would typically be:
-(BOOL)performOperationWithError:(NSError * __autoreleasing *)error;
可能是因为支持遗留代码库,其中所有NSError * error = nil; 声明都将暗示strong,因此如果Apple 将__autoreleasing 放在那里,它会导致创建一个临时的__autoreleasing 局部变量每次?只有我能想到的。
【问题讨论】:
标签: objective-c cocoa automatic-ref-counting out-parameters