{"id":31,"date":"2006-12-29T16:07:57","date_gmt":"2006-12-29T15:07:57","guid":{"rendered":"http:\/\/www.spikesoft.ch\/?p=31"},"modified":"2006-12-29T16:26:37","modified_gmt":"2006-12-29T15:26:37","slug":"nil-nil-and-null-whats-the-difference","status":"publish","type":"post","link":"https:\/\/www.spikesoft.ch\/?p=31","title":{"rendered":"nil, Nil and NULL what&#8217;s the difference?"},"content":{"rendered":"<p>If you use <a title=\"GCC, the GNU Compiler Collection\" target=\"_blank\" href=\"http:\/\/gcc.gnu.org\/\">GCC<\/a>, you will most probably never ever see a difference between this 3 keywords and can use them interchangeably. If you use another compiler, if you just wonder or if you care about writing semantically correct code then just keep reading.<\/p>\n<ul>\n<li><strong>nil<\/strong> is a null object pointer, (id)0 [that is the number 0 casted to the type id]<\/li>\n<li><strong>Nil<\/strong> is a null class pointer, (Class)0 [that is the number 0 casted to the type Class]<\/li>\n<li><strong>NULL<\/strong> is a null pointer constant, (void *)0 [it&#8217;s a preprocessor macro defined by ANSI C]<\/li>\n<\/ul>\n<p>Then be carefull to use only nil whith object and not with a numerical primitive type. Otherwise you could have some unpleasant suprises.<br \/>\nSource for <a target=\"_blank\" href=\"http:\/\/developer.apple.com\/documentation\/Cocoa\/Conceptual\/ObjectiveC\/Articles\/chapter_950_section_3.html#\/\/apple_ref\/doc\/uid\/TP30001163-CH3-TPXREF102\">Objective-C<\/a> and for ANSI C, NULL is standardly defined in <em>stddef.h<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you use GCC, you will most probably never ever see a difference between this 3 keywords and can use them interchangeably. If you use another compiler, if you just wonder or if you care about writing semantically correct code &hellip; <a href=\"https:\/\/www.spikesoft.ch\/?p=31\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,9],"tags":[],"class_list":["post-31","post","type-post","status-publish","format-standard","hentry","category-objective-c","category-programmation"],"_links":{"self":[{"href":"https:\/\/www.spikesoft.ch\/index.php?rest_route=\/wp\/v2\/posts\/31","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.spikesoft.ch\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.spikesoft.ch\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.spikesoft.ch\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.spikesoft.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=31"}],"version-history":[{"count":0,"href":"https:\/\/www.spikesoft.ch\/index.php?rest_route=\/wp\/v2\/posts\/31\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.spikesoft.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=31"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.spikesoft.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=31"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.spikesoft.ch\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=31"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}