dev builds
themes manual
device status forums
mailing lists
IRC bugs
dev guide

Rockbox mail archive

Subject: Re: Read errors

Re: Read errors

From: Mike Holden <>
Date: Thu, 13 Mar 2003 16:29:01 -0000 (GMT)

Björn Stenberg said:
> Mike Holden wrote:
>> We sometimes return 0 for success,
>> sometimes for error, but often use "if (somefunction())" type
>> constructs, which can be misleading, since the value being tested may
>> not follow the usual tradition of 0=true, anything else=false.
> Maybe because it's actually the opposite. 0 == false, anything else ==
> true. :-)

Yes, that's what I meant! Read that comment in conjunction with what I was
saying - I've got 0 and 1 blindness after studying that code! What I was
trying to say is that sometimes 0 = success, sometimes 0 = failure

Maybe a better construct would be to define 2 macros, called success() and
failure() which do a bit of hidden "magic" to make the code more readable.
That way you can write "if (success(somefunction()))", which is way more
readable than "if(somefunction())" where somefunction() returns 0 for

> But I think you may indeed have found something. 'ret' should be
> initialized at the top of the loop, not at the bottom.

I'll compile this tonight and report back, after I've been for a long walk!
Mike Holden
Received on 2003-03-13

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy