Path: utzoo!mnetor!uunet!husc6!uwvax!oddjob!gargoyle!ihnp4!occrsh!uokmax!rmtodd From: rmtodd@uokmax.UUCP (Richard Michael Todd) Newsgroups: comp.lang.c Subject: Re: return vs exit() [was Re: exit(main(argc,argv,env));] Message-ID: <983@uokmax.UUCP> Date: 22 Dec 87 20:47:15 GMT References: <10875@brl-adm.ARPA> <176@fxgrp.UUCP> <1286@laidbak.UUCP> <1293@laidbak.UUCP> Reply-To: rmtodd@uokmax.UUCP () Organization: University of Oklahoma, Norman, OK Lines: 13 In article <1293@laidbak.UUCP> daveb@laidbak.UUCP (Dave Burton) writes: >Have return and exit() always been equivalent? >If so, why is there an exit() function call, since > the semantics are the same? A return n from the function main() is equivalent to exit(n) on most (but not, alas, all) implementations. But, if in some other function you need to suddenly exit the program (say, on discovery of some catastrophic error condition), you need a way to exit the program then and there; that's what you need exit() for. -------------------------------------------------------------------------- Richard Todd USSnail:820 Annie Court,Norman OK 73069 UUCP: {allegra!cbosgd|ihnp4}!occrsh!uokmax!rmtodd