Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!umcp-cs!chris From: chris@umcp-cs.UUCP (Chris Torek) Newsgroups: net.lang.c Subject: Re: functions that don't return Message-ID: <3705@umcp-cs.UUCP> Date: Mon, 6-Oct-86 20:05:19 EDT Article-I.D.: umcp-cs.3705 Posted: Mon Oct 6 20:05:19 1986 Date-Received: Wed, 8-Oct-86 06:43:15 EDT References: <584@hadron.UUCP> <86900070@haddock> <1216@bunker.UUCP> <147@bobkat.UUCP> Reply-To: chris@umcp-cs.UUCP (Chris Torek) Organization: University of Maryland, Dept. of Computer Sci. Lines: 36 In article <147@bobkat.UUCP> pedz@bobkat.UUCP (Pedz Thing) writes: >I think [the support library start-up code] should be the second >choice, main(); exit(0);. The reason is two fold. First, unless >a program specifically bombs off, it should exit with a happy status. >Falling off the bottom of main I would not consider to be doing >anything specific yet the return (and exit) value will be random. But it is doing something specific: the close-brace, if reachable, is equivalent to `return;'. I doubt that anyone would argue that double foo() { return; } is correct. Is then int main(argc, argv) ... { ... return; } correct? [The trick, of course, is that I have slipped in the keyword `int', which cannot be found modifying main() in K&R. On the other hand, the use of exit() to enforce clean termination, and (not so incidentally) make that last close-brace unreachable, is covered.] >Second, with a random exit status, it makes the program much less >usefull. Make(1) will sometimes work and sometimes fail, etc. Indeed. So fix the program. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 1516) UUCP: seismo!umcp-cs!chris CSNet: chris@umcp-cs ARPA: chris@mimsy.umd.edu