exit codes (was: Identifier length?)
Doug Gwyn
gwyn at smoke.BRL.MIL
Wed Mar 22 16:22:45 AEST 1989
In article <6268 at bsu-cs.UUCP> dhesi at bsu-cs.UUCP (Rahul Dhesi) writes:
>Existing programs almost never use anything other than a return code of
>0, 1, or 2. It almost doesn't matter what the standard says about the
>number of bits used. In fact the standard could simply have said:
>"...if the value of the exit code is not 0, 1, or 2, it is interpreted
>in an implementation-dependent manner". That would not affect more
>than about 0.2% of existing C programs. The current standard affects
>all of them.
Not true. Existing UNIX C programs that use exit codes as you describe
will continue to work when the UNIX environment is upgraded to ANSI C
standard conformance. Existing C programs that rely on UNIX semantics
for the exit codes are already nonportable, and the C standard reflects
that fact (it doesn't *cause* it). After a long pitched battle, X3J11
at least agreed that 0 could be promised to mean "success" in all
conforming implementations. Thus, if you don't want to use the
portability macros EXIT_SUCCESS and EXIT_FAILURE, so long as your
application is always "successful" even in adverse circumstances you
can have it terminate by returning 0 in any conforming hosted environment.
More information about the Comp.std.c
mailing list