exit codes (was: Identifier length?)

Rahul Dhesi dhesi at bsu-cs.UUCP
Wed Mar 22 23:47:54 AEST 1989


In article <9902 at smoke.BRL.MIL> gwyn at brl.arpa (Doug Gwyn (VLD/VMB) <gwyn>)
writes (responding to my article in which I say most existing C programs
exit with a code of 0, 1, or 2 and that 0=success, nonzero=failure is
a common convention):

>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).

Scanning through C programming textbooks, which are geared towards a
variety of implementations not all under UNIX, we consistently find
exit(0) and exit(1) used for success and failure respectively.

It doesn't matter that these existing programs are "nonportable", if
that means (as it does in this case) "won't work under VAX/VMS".
-- 
Rahul Dhesi         UUCP:  <backbones>!{iuvax,pur-ee}!bsu-cs!dhesi
                    ARPA:  dhesi at bsu-cs.bsu.edu



More information about the Comp.std.c mailing list