objective c - __autoreleasing in error:(NSError *__autoreleasing *)outError -
I saw this pattern in apple functions which return errors
error: ( NERR * __ Autorezing *) External error I understand that this is an indicator of the indicator, used to complete the result (only * using only local copy variables I'm concerned about changing, but not out)
__i autoreleasing
If I leave it out Vendor What happens then? Do I get a leak? Why is it necessary? ........ ............. ......... < p>
You do not have to specify __autoreleasing for specifying, for example - (BOOL) doSomething: (NSError **) error; The ARC compiler automatically includes __autotizing . It is explained in the documentation: 4.4.2 Indirect parameter
If a function or method parameter is type T *, where T is a proprietor-not ineligible Qualified Indicator Type:
- If T is a const-qualified or class, then it is viable with __unsafe_unatedened;
- Otherwise, it is vested with __autoreleasing.
Xcode code completion is also known about it and displays the (NSError * __ autoreleasing *) error . Calling such a function ARC compiler automatically "correctly" so that you can call NSError * error ; BOOL success = [self-doSomething: and error]; As explained, the compiler incorporates a temporary __autoeryising variable: NSError * error; NSError * __autoreleasing tmp = error; BOOL success = [self doSomething: & amp; Amp; TMP]; Error = TMP; (You can read 4.3.4 "Passing by a parameter to write" in the CLAG / ARC documentation for the explanatory description.)
Comments
Post a Comment