Subject: Re: a few minor cleanups to src/share/misc/style
To: None <firstname.lastname@example.org, email@example.com>
From: Thor Lancelot Simon <firstname.lastname@example.org>
Date: 03/21/2001 22:28:02
On Wed, Mar 21, 2001 at 07:16:37PM -0800, Chris G. Demetriou wrote:
> Greywolf <email@example.com> writes:
> > Can I ask what the point is of (strongly) suggesting such things as
> > EXIT_SUCCESS and EXIT_FAILURE as opposed to 0 and 1? That just
> > seems such a PITA.
> (1) They're more portable. I.e., really, not all systems which support
> 'standard C' use success == 0 and failure == non-zero. Sure, those
> systems aren't really unix, but since KNF already says 0 / 1, it seems
> fairly obvious and non-bad to use the standards-defined exit codes.
> (2) They have immediately-obvious meaning. If you're coming up to
> UNIX code for the first time, what do you think: is 0 or 1 success or
> failure? (Why is it intuitively obvious that it should be different
> than, say, true or false booleans?) EXIT_* makes the code a bit more
> > The other thing is what if you need to denote different conditions
> > via different exit stats (as in success, failure-because-of-runtime-
> > criteria-mismatch, failure-because-of-resource-unavailability)?
> > i.e., what if it's possible for something to fail in several different
> > ways? I think it'd be the polite thing to do to provide (and document)
> > several different exit codes.
> That's been "prohibited" by KNF forever.
> As with many things, if there's a good, strong reason to do otherwise,
> then it's reasonable. But for random failures of a program, there's
> no great reason to differentiate.
Besides, we have <sysexits.h> and it would be nice to at least use it consistently,
instead of making up Special New Exit Codez for every single program.
Thor Lancelot Simon firstname.lastname@example.org
And now he couldn't remember when this passion had flown, leaving him so
foolish and bewildered and astray: can any man?