Re: [hackers] [sbase] Stop using EXIT_{SUCCESS,FAILURE} || sin

From: Dimitris Papastamos <sin_AT_2f30.org>
Date: Fri, 3 Oct 2014 10:46:47 +0100

On Fri, Oct 03, 2014 at 11:39:35AM +0200, Roberto E. Vargas Caballero wrote:
> Hi,
>
> I don't have any problem with the patch, but I don't
> understand why EXIT_{SUCCESS,FAILURE} is a problem.

From a quick look I had in n1256.pdf:

"If the value of status is zero or EXIT_SUCCESS, an implementation-defined
form of the status successful termination is returned. If the value
of status is EXIT_FAILURE, an implementation-defined form of the status
unsuccessful termination is returned. Otherwise the status returned is
implementation-defined."

So for EXIT_SUCCESS, zero is also a perfectly valid alternative and will
signal success correctly. If EXIT_FAILURE is not 1 (I am not aware of any
such system) then we may fall into the 3rd category.

These macros are too long to type and they don't offer much. Someone may
end up returning multiple different values to the environment, like EXIT_FOO
and EXIT_BAR and may think this is consistent with the EXIT_SUCCESS naming.
But generally programs that return more than a single value are a
rarity and generally discouraged (xargs(1) comes to mind).

This is really to avoid typing and verbosity in places where it shouldn't
matter.
Received on Fri Oct 03 2014 - 11:46:47 CEST

This archive was generated by hypermail 2.3.0 : Fri Oct 03 2014 - 11:48:09 CEST