Weak reference: Difference between revisions

Content deleted Content added
Garbage collection: Underscores in shared_ptr and weak_ptr
m Vala: add link
Line 97:
The difference between <code>weak</code> (<code>__weak</code>) and <code>unsafe_unretained</code> (<code>__unsafe_unretained</code>) is that when the object the variable pointed to is being deallocated, whether the value of the variable is going to be changed or not. <code>weak</code> ones will be updated to [[Null pointer|<code>nil</code>]] and the <code>unsafe_unretained</code> one will be left unchanged, as a [[dangling pointer]]. The <code>weak</code> references is added to Objective-C since [[Mac OS X Lion|Mac&nbsp;OS&nbsp;X&nbsp;10.7&nbsp;"Lion"]] and [[iOS 5]], together with [[Xcode]] 4.1 (4.2 for iOS), and only when using ARC. Older versions of Mac OS X, iOS, and GNUstep support only <code>unsafe_unretained</code> references as weak ones.
 
===[[Vala (programming language)|Vala]]===
<source lang=vala>
class Node {