Path: utzoo!mnetor!uunet!husc6!rutgers!mcnc!rti!xyzzy!goudreau From: goudreau@xyzzy.UUCP (Bob Goudreau) Newsgroups: comp.lang.c Subject: Re: exit(-1), 0 is sometimes magic Message-ID: <562@xyzzy.UUCP> Date: 17 Jan 88 19:45:32 GMT References: <502@cresswell.quintus.UUCP> <6935@brl-smoke.ARPA> <1179@wjvax.UUCP> <6983@brl-smoke.ARPA> <7208@ki4pv.uucp> <23160@cca.CCA.COM> <1843@bsu-cs.UUCP> <2305@bloom-beacon.MIT.EDU> <1868@bsu-cs.UUCP> Reply-To: goudreau@dg-rtp.UUCP (Bob Goudreau) Organization: Data General Corporation, Research Triangle Park, NC Lines: 20 Keywords: exit, zero, flaming In article <1868@bsu-cs.UUCP> dhesi@bsu-cs.UUCP (Rahul Dhesi) writes: >I gave a number of example attempting to show that zero is inherently >a unique integer and therefore not a "magic number" in the usual >sense of the term. >.... >It seems to make perfect sense to me that in the non-VMS world in which >a single successful termination value, and multiple failure termination >values, are needed, zero should be the successful termination value. > >Therefore the use of exit(0) for successful termination is not >arbitrary. It is intuitively correct. Gee that's swell, but it still doesn't address the issue of the magic number. You can stamp your feet and pout all you want at "non-intuitive" operating systems, but your code still won't port to them easily. Doug Gwyn is still correct: zero is definitely a magic number when used as the successful termination value. Your point about zero as the first index to an array is irrelevant: such behavior is part of the specification of the C language. Return statuses are OS-dependent, and are explicitly beyond the scope of X3J11.