changes to compare_string_array

Rich Felker dalias at aerifal.cx
Sun Sep 3 18:09:48 UTC 2006


On Sun, Sep 03, 2006 at 01:14:55PM -0300,  Alastor Santamaria wrote:
> >Many things return -1 to mean "it didn't work".  open() returns -1 if it
> >couldn't open, chdir(), chmod(), chown(), accept(), access(), fcntl(),
> >getpgrp(), sprintf()...
> 
> just because everybody does it the A way, don't mean there's no better B
> way.

Consistency with the language you're coding in is worth something.

> >In C, array indexes count up from 0.  You'd rather break the meaning of
> >array
> 
> so? opengl does it also.

OpenGL is hardly the pinnacle of competent (nonbloated) API design..

> indexes on success than go with the common practice of using -1 as an error
> >value.  I don't agree.
> >
> >> and some applets could benefit two.
> >
> >Define "benefit".
> 
> size improvements, look at the comments in previous message, is not a lot
> but something is better than nothing, if you think it's not worth it, or it
> makes the code less readable or uglier it's ok by me, I was just asking if
> it was good or bad

How is changing the error result supposed to make code smaller?
Especially since you have to subtract 1 after checking for error in
order to get a valid array index..

Rich




More information about the busybox mailing list