Rockbox mail archiveSubject: Re: Read errors
Re: Read errors
From: Henrik Backe <backe_at_swipnet.se>
Date: Fri, 14 Mar 2003 09:42:22 +0100
"Linus Nielsen Feltzing" wrote
> Mike Holden wrote:
> > The other option, where the function does not return a boolean, is to
> > this more obvious in the if statement, so the above becomes "if (0 !=
> > somefunction())", which makes the whole thing readable without hidden
> > macros, and also makes it obvious to the reader of the code that
> > somefunction() doesn't return a boolean, but an integer instead.
> I'm not sure I agree. The fairly experienced C programmer knows what's
> going on when he sees the "if(somefunction())" construct. He knows that
> any nonzero value is a true value, boolean or not. He should also be
> able to see from the context if a nonzero value is a success or not.
Not everyone are are experienced C programmers!
Personally I'm an experienced programmer but since I'm on a good (bad
day have to read Cobal,Fortran,C,C++, ksh and csh code on three different
(Win32,OS/390 and Unix), I'm really gratefull for everything that avoids
> > That way
> > it helps the reader who is not intimately familiar with the code, who
> > not know (without checking the source for it) that somefunction()
> > 0 for success.
> 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.
Received on 2003-03-14