Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!brl-smoke!smoke!JOSH%YKTVMH.BITNET@wiscvm.ARPA From: JOSH%YKTVMH.BITNET@wiscvm.ARPA (Josh Knight) Newsgroups: net.lang.c Subject: Re: Fast code and no morals ( Really exit() semantics ) Message-ID: <1094@brl-smoke.ARPA> Date: Wed, 19-Feb-86 03:11:14 EST Article-I.D.: brl-smok.1094 Posted: Wed Feb 19 03:11:14 1986 Date-Received: Fri, 21-Feb-86 07:07:37 EST Sender: news@brl-smoke.ARPA Lines: 56 > 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) > > 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 > > 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@yktvmh.BITNET, josh.yktvmh@ibm-sj.arpa