Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: Re: Read errors
From: Robert Hak (rhak_at_ramapo.edu)
Date: 2003-03-13


Just my two bits..

If you are going to use a function, you should understand what it accepts
as arguements and returns as a result. In the end, it is your
responsibility to make the code readable/usable.

I don't feel putting unneeded restrictions helps where one could read the
code itself to understand what is happening.

/Adi

On Thu, 13 Mar 2003, Mike Holden wrote:

The other option, where the function does not return a boolean, is to make
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. That way
it helps the reader who is not intimately familiar with the code, who may
not know (without checking the source for it) that somefunction() returns
0 for success.

> A simple comment may be in place, however.

Indeed. A well placed comment can make a world of difference, especially
when unfamiliar with the code.

+-- --- --- --- --- --- --- --- --- --- --- --- --- --+
| Robert E. Hak < http://phobos.ramapo.edu/~rhak > |

"We live together, we act on and react to, one another; but always and in all
 circumstances we are by ourselves."
        - Aldous Huxley



Page was last modified "Jan 10 2012" The Rockbox Crew
aaa