Path: utzoo!mnetor!uunet!nuchat!sugar!peter From: peter@sugar.UUCP (Peter da Silva) Newsgroups: comp.lang.c Subject: Re: exit(-1) Message-ID: <1365@sugar.UUCP> Date: 6 Jan 88 03:48:16 GMT References: <502@cresswell.quintus.UUCP> Organization: Sugar Land UNIX - Houston, TX Lines: 26 In article ... ok@quintus.UUCP (Richard A. O'Keefe) writes: > [exit()] > > The VAX-11 C manual explicitly says that the argument of exit() > should be 0 or a value errno might have. > > The Oct86 dpANS said only that 0 arguments indicate success and > non-0 arguments indicate failure in some system-dependent way. > > Except where you are writing code for a specific system (say you > have #if cases for MVS, VMS, and UNIX) it seems like a good idea > to pass only 0 or 1 to exit(). I like passing -1 because: It's negative (some systems use the sign bit to specify true/false). It's odd (some systems use the low bit for the same purpose). All bits are set (some systems do ANDS and ORS using & and |). If it's truncated, it's large (some systems use small values for warnings, and large ones for fatal errors). I've never had a system treat "-1" as a successful result. I have had one ignore a return code of 1. -- -- Peter da Silva `-_-' ...!hoptoad!academ!uhnix1!sugar!peter -- Disclaimer: These U aren't mere opinions... these are *values*.