Path: utzoo!mnetor!uunet!husc6!sri-unix!quintus!ok From: ok@quintus.UUCP (Richard A. O'Keefe) Newsgroups: comp.lang.c Subject: Re: exit(-1) Message-ID: <551@cresswell.quintus.UUCP> Date: 20 Jan 88 00:40:11 GMT References: <502@cresswell.quintus.UUCP> <6935@brl-smoke.ARPA> <1179@wjvax.UUCP> <7133@brl-smoke.ARPA> Organization: Quintus Computer Systems, Mountain View, CA Lines: 42 Summary: VMS *does* handle exit(0) In article <7133@brl-smoke.ARPA>, gwyn@brl-smoke.ARPA (Doug Gwyn ) writes: > In article <1225@nmtsun.nmt.edu> hydrovax@nmtsun.nmt.edu (M. Warner Losh) writes: > >Why would you expect an operating system dependent scheme such as exit(0) > >to work on all OS's? The whole world isn't using UNIX. > If, as you report, VMS C does not currently map exit(0) to something > sensible, that will have to be fixed before VMS C is ANSI-conforming. Everything that has been said about VMS and exit(0) so far is false. I decide that it was time to check the manual. Programming in VAX C Order Number AA-L370B-TE For VAX/VMS version 4.0 or later Compiler version VAX C version 2.0 April 1985. Section 22.1.2 exit, _exit exit([status]) _exit([status]) The optional argument status corresponds with [sic!] an errno value. ... The functions return the specified status to the parent process. ... The two functions are identical. [I do not understand how an argument can exchange letters with (correspond with) a number. No doubt they meant "correspond to". Aren't eddicayshun wunnerful?] Checking SYS$LIBRARY:ERRNO.H, I found that not only were the errno symbols (such as EPERM) the same as in UNIX, they had been given the same numbers as well. It is clear, therefore, that in the VMS implementation of C, the argument of exit() is a ***UNIX*** error number (including 0 as specifying NO error), *NOT* a VMS error code. Trying several values of N in main() { exit(N); } and main() { return N; } I found that *none* of them resulted in any message from DCL; *all* of them produced a quiet exit. {But the return code was available to DCL for inspection, and perror() does plausible things.} VAX-11 C does more optimisation than most C compilers do. For compatibility with other compilers, the preprocessor accepts but IGNORES #pragma. I wonder about the other compilers that "need" it, I really do.