{"id":449,"date":"2005-08-08T18:07:44","date_gmt":"2005-08-08T08:07:44","guid":{"rendered":"http:\/\/www.flamingspork.com\/blog\/?p=449"},"modified":"2005-08-08T18:07:44","modified_gmt":"2005-08-08T08:07:44","slug":"comments-are-evil","status":"publish","type":"post","link":"https:\/\/www.flamingspork.com\/blog\/2005\/08\/08\/comments-are-evil\/","title":{"rendered":"Comments Are Evil"},"content":{"rendered":"<p>When a comment above a function says &#8220;returns -1 on error&#8221; and the code does the exact oposite (returns -1 anyway except if there was out of memory error, which may be #defined to -1 anyway) it&#8217;s a bit annoying when you first look at it.<\/p>\n<p>Remember kids, comments in code are evil. They are wrong &#8211; or misleading at best. They only ever say what one person at some point in the past thought they beleived the code did. The definitive record is the code itself.<\/p>\n<p>(there are possible exceptions to this rule&#8230; maybe&#8230; internals can be good to document &#8211; but arguably it should be *away* from the code so that you don&#8217;t start thinking the documentation is accurate and up to date &#8211; because it&#8217;s <b>not<\/b>).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When a comment above a function says &#8220;returns -1 on error&#8221; and the code does the exact oposite (returns -1 anyway except if there was out of memory error, which may be #defined to -1 anyway) it&#8217;s a bit annoying &hellip; <a href=\"https:\/\/www.flamingspork.com\/blog\/2005\/08\/08\/comments-are-evil\/\">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":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[2,14,7],"tags":[],"class_list":["post-449","post","type-post","status-publish","format-standard","hentry","category-life-the-universe-and-everything","category-mysql","category-work-et-al"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p5a6n8-7f","jetpack-related-posts":[{"id":2253,"url":"https:\/\/www.flamingspork.com\/blog\/2011\/01\/05\/is-your-storage-engine-buggy-or-the-database-server\/","url_meta":{"origin":449,"position":0},"title":"Is your Storage Engine buggy or the database server?","author":"Stewart Smith","date":"2011-01-05","format":false,"excerpt":"If your storage engine returns an error from rnd_init (or doStartTableScan as it's named in Drizzle) and does not save this error and return it in any subsequent calls to rnd_next, your engine is buggy. Namely it is buggy in that a) an error may not be reported back to\u2026","rel":"","context":"In &quot;code&quot;","block_context":{"text":"code","link":"https:\/\/www.flamingspork.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2196,"url":"https:\/\/www.flamingspork.com\/blog\/2010\/11\/15\/limiting-functions-to-32k-stack-in-drizzle-and-scoped_ptr\/","url_meta":{"origin":449,"position":1},"title":"Limiting functions to 32k stack in Drizzle (and scoped_ptr)","author":"Stewart Smith","date":"2010-11-15","format":false,"excerpt":"I wonder if this comes under \"Code Style\" or not... Anyway, Monty and I finished getting Drizzle ready for adding \"\u00ef\u00bb\u00bf\u00ef\u00bb\u00bf\u00ef\u00bb\u00bf-Wframe-larger-than=32768\" as a standard compiler flag. This means that no function within the Drizzle source tree can use greater than 32kb stack - it's a compiler warning - and with\u2026","rel":"","context":"In &quot;code&quot;","block_context":{"text":"code","link":"https:\/\/www.flamingspork.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":450,"url":"https:\/\/www.flamingspork.com\/blog\/2005\/08\/08\/why-returns-1-on-error-is-bad\/","url_meta":{"origin":449,"position":2},"title":"Why &#8220;returns -1 on error&#8221; is bad","author":"Stewart Smith","date":"2005-08-08","format":false,"excerpt":"(a general note on what's good practice) In C, 0 is false and !0 is true. In the dim past there was an elsewhere where 0 was true and !0 was false. Why? Because there can be more than one error state and this is usually more interesting than how\u2026","rel":"","context":"In &quot;General&quot;","block_context":{"text":"General","link":"https:\/\/www.flamingspork.com\/blog\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1855,"url":"https:\/\/www.flamingspork.com\/blog\/2010\/03\/17\/stored-proceduresfunctions-for-drizzle\/","url_meta":{"origin":449,"position":3},"title":"Stored Procedures\/Functions for Drizzle","author":"Stewart Smith","date":"2010-03-17","format":false,"excerpt":"Previously, in \"Thoughts on Thoughts on Drizzle\" I theorized that one of the major reasons why we did not see lots of people jumping at stored procedures in MySQL was that it wasn't in their native language (for lack of a better term). We've seen External Language Stored Procedures for\u2026","rel":"","context":"In &quot;code&quot;","block_context":{"text":"code","link":"https:\/\/www.flamingspork.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2041,"url":"https:\/\/www.flamingspork.com\/blog\/2010\/06\/29\/enum-now-works-properly-in-drizzle\/","url_meta":{"origin":449,"position":4},"title":"ENUM now works properly (in Drizzle)","author":"Stewart Smith","date":"2010-06-29","format":false,"excerpt":"Over at the Drizzle blog, the recent 2010-06-07 tarball was announced. This tarball release has my fixes for the ENUM type, so that it now works as it should. I was quite amazed that such a small block of code could have so many bugs! One of the most interesting\u2026","rel":"","context":"In &quot;drizzle&quot;","block_context":{"text":"drizzle","link":"https:\/\/www.flamingspork.com\/blog\/category\/work-et-al\/drizzle-work-et-al\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":658,"url":"https:\/\/www.flamingspork.com\/blog\/2006\/04\/19\/rusty-on-floating-point-and-keeping-neat-code\/","url_meta":{"origin":449,"position":5},"title":"Rusty on floating point (and keeping neat code)","author":"Stewart Smith","date":"2006-04-19","format":false,"excerpt":"Rusty talks about the \"fun\" of floating point and how this all ties into Wesnoth. Platform consistency is certainly a good thing - so I'm guessing the attack_prediction code isn't run by each node in a network game in a way where machines could disagree on the outcome. This does\u2026","rel":"","context":"In &quot;mysql&quot;","block_context":{"text":"mysql","link":"https:\/\/www.flamingspork.com\/blog\/category\/work-et-al\/mysql\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/posts\/449","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/comments?post=449"}],"version-history":[{"count":0,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/posts\/449\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/media?parent=449"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/categories?post=449"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.flamingspork.com\/blog\/wp-json\/wp\/v2\/tags?post=449"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}