{"id":5062,"date":"2014-03-30T18:30:47","date_gmt":"2014-03-30T18:30:47","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/deallocated-instance-and-nil-object-in-objective-c-collection-of-common-programming-errors\/"},"modified":"2014-03-30T18:30:47","modified_gmt":"2014-03-30T18:30:47","slug":"deallocated-instance-and-nil-object-in-objective-c-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/deallocated-instance-and-nil-object-in-objective-c-collection-of-common-programming-errors\/","title":{"rendered":"Deallocated instance and nil object in objective-c-Collection of common programming errors"},"content":{"rendered":"<p>Coming from a java background, where everything goes under null pointer exception, I found some difficulties in understanding the difference between nil and deallocated instance in objective-c.<\/p>\n<p>In objective-c it is known that sending a message to a nil object is not sorting any effect to the program flow.<\/p>\n<p>However, sending a message to a deallocated object result in message to deallocated instance error.<\/p>\n<p>In my ideal world a deallocated instance is &#8216;nil&#8217;, but obviously is not.<\/p>\n<p>The precise question are:<\/p>\n<ul>\n<li>what happens to the object when it is deallocated ?<\/li>\n<li>If the object is deallocated, shouldn&#8217;t it be freed, and then become nil ?<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Coming from a java background, where everything goes under null pointer exception, I found some difficulties in understanding the difference between nil and deallocated instance in objective-c. In objective-c it is known that sending a message to a nil object is not sorting any effect to the program flow. However, sending a message to a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5062","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5062","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=5062"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5062\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=5062"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=5062"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=5062"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}