Fast code and no morals ( Really exit() semantics )
Josh Knight
JOSH%YKTVMH.BITNET at wiscvm.ARPA
Wed Feb 19 18:11:14 AEST 1986
> Date: 17 Feb 86 14:46:00 PST
>
> > Date: Sat, 15 Feb 86 21:43:34 EST
> >
> > If VMS does not support exit(0) as successful termination,
> > then VMS is WRONG and needs to fix their exit() routine.
> > Doug Gwyn (VLD/VMB) <gwyn at BRL.ARPA>
>
> I know this is naive, but then this flock is full of naive users...
> Doug, where exactly do Kernighan & Ritchie specify the semantics of
> the exit() procedure ?
>
> The common semantics seem to me to be "return to the surrounding
> operating system level, using the argument value as the return code".
> Unfortunately for portability, UN*X and VMS have different ideas about
> the semantics of program return codes, but you can't say VMS is WRONG
> just because it's DIFFERENT unless you can quote chapter and verse.
>
> Does the ANSI draft specify semantics for system calls ?
>
> / Lars Poulsen
> Advanced Computer Communications
> <Lars @ ACC.ARPA>
>
Chapter and verse:
>From ANSI C Standard Draft Version dated 11 August 1985,
Section D.10.4.2, "The exit function" (third paragraph):
Finally, control is returned to the host environment. If the
value of *status* is zero, the status returned is *successful
termination*; otherwise an implementation-defined form of the
status *unsuccessful termination* is returned.
>From K&R, Chapter 7, Section 7, "Error Handling - Stderr and Exit"
p. 154, next to the last paragraph:
The program also uses the standard library function *exit*, which
terminates program execution when it is called. The argument of
*exit* is available to whatever process called this one, so the
success or failure of the program can be tested by another program
that uses this one as a sub-process. By convention, a return value
of 0 signals that all is well, and various non-zero values signal
abnormal situations.
Of course, any opinions, expressed or implied are mine and not my
employers...
Josh Knight
IBM T.J. Watson Research Center
josh at yktvmh.BITNET, josh.yktvmh at ibm-sj.arpa
More information about the Comp.lang.c
mailing list