为什么 Apple 的方法没有将 NSError**
声明为 NSError * __autoreleasing *
?
Transitioning to ARC Release Notes似乎暗示他们应该是(?)。
例如,NSFileManager.h 中的所有例程。但我实际上没有看到任何使用过渡到 ARC 发行说明中提到的内容的 Apple header :
and the method declaration would typically be:
-(BOOL)performOperationWithError:(NSError * __autoreleasing *)error;
可能是因为支持所有 NSError * error = nil;
声明都将暗示 strong
的遗留代码库,所以如果 Apple 将 __autoreleasing
在那里它会导致每次都创建一个临时的 __autoreleasing
局部变量?我唯一能想到的。
最佳答案
指向 Objective-C 对象的双指针是隐式的 __autoreleasing
,由 LLVM spec 指定.
关于objective-c - 为什么 Apple header 没有 NSError** 参数的 __autoreleasing?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14988157/