Carmack about static analysis

Jacob Carlborg doob at me.com
Mon Dec 26 03:47:51 PST 2011


On 2011-12-26 03:31, Adam D. Ruppe wrote:
> On Monday, 26 December 2011 at 00:40:47 UTC, Andrei Alexandrescu wrote:
>> I understand. Personally, I am unable to bring myself to fathom why
>> writing this has any advantage:
>
> if(condition) return false just avoids a negation in the
> condition.
>
> It's easier to miss a "!" entirely than to miss a "return false",
> and personally, I've been finding it takes an extra brain cycle
> to invert a condition anyway.
>
> I like an individual line of code to be dumb as a rock anyway.

It's like when you see code like this (Ruby):

unless !foo

end

Double negation. Code like the snippet above can be really annoying.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list