Rockbox mail archive
Subject: Re: Read errors
From: Linus Nielsen Feltzing (linus_at_haxx.se)
Henrik Backe wrote:
>>I don't see the difference. The if(func()) and the if(0 != func()) are
>>the same thing, and I prefer the first one, because there is less fluff.
>>The only issue is the "polarity" of the return code.
> The only difference between them is that one contains hidden magic.
Magic? Not at all. C is not magic. The if(func()) construct is a de
facto standard in the C language. Look around you, this is how C is
written, like it or not. I prefer C code that is written like that,
because then it looks like any other C code.
If you write it differently, the C programmer has to look twice to see
what the programmer has intended to do, since the construct is not the
usual one. Constructs like if(0 != func()) catches my eye and leads me
to thing "uh uh, this looks fishy, what is he trying to do?".
Page was last modified "Jan 10 2012" The Rockbox Crew