exit codes (was: Identifier length?)

Rahul Dhesi dhesi at bsu-cs.UUCP
Wed Mar 22 13:56:52 AEST 1989


In article <12111 at haddock.ima.isc.com> karl at haddock.ima.isc.com (Karl Heuer)
writes [about my claim that 0=normal nonzero=error in exit(n)]:
>This is not common practice.  Even in Unix, the current situation is that
>(n%256==0) denotes normal exit, (n%256!=0) flags an error.

(The reference here is to the fact that only the lowest 8 bits of n
are used.)

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