[patch] save ~600B
Paul Fox
pgf at brightstareng.com
Mon Jun 5 12:41:27 UTC 2006
wharm wrote:
> Bernhard Fischer wrote:
> > On Mon, Jun 05, 2006 at 01:04:06PM +0200, walter harms wrote:
> >> hi bernhard,
> >> just a minor question.
> >> Does exit(-1) make sense ? so far i remember the shell expects 0-255.
> >
> > IMO it does make sense. It it a means to make sure to return ~0, no
> > matter what return type the shell happens to use.
> > So, for "the shell" -- which likely happens to use unsigned char -- we
> > return 255, while we wouldn't have to change all explicit calls to
> > {_,}exit(255) iff the type would change, for whatever reason.
> > Makes sense?
only if that's what the programmer intended. in my experience,
people that write "exit(-1)" usually are confusing the exit
status or the program with the return code from a C function, and
are forgetting that the traditional error exit status for a
program is "1", or some other small non-zero integer.
> personally i am the fan of
> exit( EXIT_FAILURE ) ;
and "EXIT_FAILURE" is cleverly defined as "1", right? why
not just "exit(1)"? this keeps it simple, concise, and transparent.
> we should define a way in the style guide.
> and get rid of stuff like:
> exit(ERROR);
i agree. but "s/ERROR/EXIT_FAILURE/" accomplishes nothing.
paul
=---------------------
paul fox, pgf at brightstareng.com
More information about the busybox
mailing list