Should the out keyword still be used to annotate output parameters of Objective-C methods?

Some headers still use the `out` keyword when declaring out paramaters of Objective-C methods, e.g. `- (BOOL)setWLANChannel:(CWChannel *)channel error:(out NSError **)error NS_AVAILABLE_MAC(10_7);`


Is there practical difference when this keyword (qualifier?) is present / abscent for ObjC/ObjC++ (ARC / non-ARC), Swift or AppleScript?


The only relevant reference I have found is in Objective-C Automatic Reference Counting doc for Clang, in the section 4.3.4:


4. If the parameter is not an Objective-C method parameter marked

out
, then
*p
is read, and the result is written into the temporary with primitive semantics.


It's not clear to my why "out" makes such a difference.

Answered by Kentzo in 422102022

Answering my own question: `out` tells the compiler that current value of the retainable object pointer is of no importance to the receiver which allows to elide some retain / release calls. The usecase documented above is actually the only usecase in Apple Clang 11.0.0

Accepted Answer

Answering my own question: `out` tells the compiler that current value of the retainable object pointer is of no importance to the receiver which allows to elide some retain / release calls. The usecase documented above is actually the only usecase in Apple Clang 11.0.0

Should the out keyword still be used to annotate output parameters of Objective-C methods?
 
 
Q