Reputation: 51
I got some questions after reading the answer to this thread Handling Pointer-to-Pointer Ownership Issues in ARC;
For demo 1, when a reference to a 'strong' attributed variable is passed, a hidden(__autoreleasing) variable is implicitly created and the object doesn't get retained. However for demo 4, when a reference to a 'weak' attributed variable is passed, the object does get retained once.
So my question is quite simple as just my curiosity, why only the hidden variable created from '__weak' gets the object retain+1? Is this pattern designed for any special concerns?
Hoping I explain my question clearly, any help will be appreciated.
Upvotes: 2
Views: 294
Reputation: 122499
a hidden(__autoreleasing) variable is implicitly created and the object doesn't get retained
This is not true. __autoreleasing
is something that is retained and autoreleased.
Upvotes: 0