Pergunta

Why aren’t Apple’s methods that take NSError** declared as NSError * __autoreleasing * ?

The Transitioning to ARC Release Notes seems to suggest that they should be (?).

For example, all the routines in NSFileManager.h. But I don't actually see any of the Apple headers using what is noted in the Transitioning to ARC Release Notes:

and the method declaration would typically be:

-(BOOL)performOperationWithError:(NSError * __autoreleasing *)error;

Could it be because of supporting legacy code bases where all the NSError * error = nil; declarations are going to imply strong and so if Apple put __autoreleasing in there it'd cause a temporary __autoreleasing local variable to be created every time? Only thing I can think of.

Foi útil?

Solução

Double pointers to Objective-C objects are implicitly __autoreleasing as specified by the LLVM spec.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top