Path: utzoo!mnetor!uunet!husc6!cmcl2!yale!moran From: moran@yale-zoo-suned..arpa (William L. Moran Jr.) Newsgroups: comp.lang.c Subject: Re: return vs exit() [was Re: exit(main(argc,argv,env));] Message-ID: <20664@yale-celray.yale.UUCP> Date: 22 Dec 87 09:16:08 GMT References: <10875@brl-adm.ARPA> <176@fxgrp.UUCP> <1286@laidbak.UUCP> <1293@laidbak.UUCP> Sender: root@yale.UUCP Reply-To: moran@yale-zoo-suned.UUCP (William L. Moran Jr.) Organization: Yale University - Dept. of Computer Science Lines: 27 In article <1293@laidbak.UUCP> daveb@laidbak.UUCP (Dave Burton) writes: ... > >OK. They are equivalent. >K&R says so, K&P says so, H&S says so, etc., etc. > >Have return and exit() always been equivalent? > >If so, why is there an exit() function call, since > the semantics are the same? I hate to make a silly observation like this, but return and exit aren't the same (they don't have the same semantics) except perhaps when used in main. Unless I am mistaken, exit() will leave from anywhere, and return() returns to the calling function (in main this is like an exit(). Perhaps I have missed the point, but I'm sure someone will tell me if this is the case. William L. Moran Jr. moran@{yale.arpa, cs.yale.edu, yalecs.bitnet} ...{ihnp4!hsi,decvax}!yale!moran Charm is the great English blight. It does not exist outside these damp islands. It spots and kills anything it touches. It kills love; it kills art; I greatly fear, my dear Charles, it has killed you. Brideshead Revisited