{"id":526,"date":"2009-12-09T06:13:18","date_gmt":"2009-12-09T11:13:18","guid":{"rendered":"http:\/\/vgable.com\/blog\/?p=526"},"modified":"2009-12-09T06:23:56","modified_gmt":"2009-12-09T11:23:56","slug":"compile-safer","status":"publish","type":"post","link":"https:\/\/vgable.com\/blog\/2009\/12\/09\/compile-safer\/","title":{"rendered":"Compile Safer"},"content":{"rendered":"<p><a href=\"http:\/\/boredzo.org\/blog\/archives\/2009-11-07\/warnings\">Peter Hosey explains what warnings he uses and why<\/a>. It&#8217;s good, but long. Fortunately, you can <a href=\"http:\/\/rentzsch.tumblr.com\/post\/237349423\/hoseyifyxcodewarnings-scpt\">just grab a script<\/a>, and enable those warnings in your Xcode projects.<\/p>\n<h3>Warnings = Errors<\/h3>\n<p>If I could force just one compiler flag on everyone who&#8217;s code I use, it would be <code>TREAT_WARNINGS_AS_ERRORS<\/code>. As a rule, things don&#8217;t get improved if they aren&#8217;t broken. (How many times have you said &#8220;I&#8217;ll come back and fix this code later&#8221;? Yeah.)  Warnings fester and grow on each other, until they cause a real breakage. It&#8217;s an inescapable evil of building software with finite resources.<\/p>\n<p>If a warning isn&#8217;t worth stopping the build over &#8212; it&#8217;s not worth checking for in the first place.<\/p>\n<h3>Use the Latest Tools<\/h3>\n<p>Specifically, if you aren&#8217;t using <a href=\"http:\/\/www.amazon.com\/gp\/product\/B001AMHWP8?ie=UTF8&#038;tag=vincgabl-20&#038;linkCode=as2&#038;camp=1789&#038;creative=390957&#038;creativeASIN=B001AMHWP8\">Snow Leopard<\/a> and Xcode 3.2 to build your Objective-C code, <strong>you are crazy<\/strong>. Trust me, <a href=\"http:\/\/developer.apple.com\/mac\/library\/featuredarticles\/StaticAnalysis\/index.html\">painless static analysis<\/a> is worth upgrading for. It catches maddening memory leaks, not just trivial type errors, like adding an <code>int<\/code> to an <code>NSArray<\/code>, that you would catch immediately.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Peter Hosey explains what warnings he uses and why. It&#8217;s good, but long. Fortunately, you can just grab a script, and enable those warnings in your Xcode projects. Warnings = Errors If I could force just one compiler flag on everyone who&#8217;s code I use, it would be TREAT_WARNINGS_AS_ERRORS. As a rule, things don&#8217;t get [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18,7,6,203,3,5,4],"tags":[243,76,548,134],"class_list":["post-526","post","type-post","status-publish","format-standard","hentry","category-bug-bite","category-c","category-cocoa","category-iphone","category-macosx","category-objective-c","category-programming","tag-compilers","tag-gcc","tag-warnings","tag-xcode"],"_links":{"self":[{"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/posts\/526","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/comments?post=526"}],"version-history":[{"count":3,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/posts\/526\/revisions"}],"predecessor-version":[{"id":529,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/posts\/526\/revisions\/529"}],"wp:attachment":[{"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/media?parent=526"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/categories?post=526"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/tags?post=526"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}