Path: utzoo!utgpu!water!watmath!clyde!rutgers!ll-xn!mit-eddie!uw-beaver!uw-june!pardo From: pardo@uw-june.UUCP (David Keppel) Newsgroups: comp.lang.c Subject: Re: exit(main(argc,argv,env)); Message-ID: <3852@uw-june.UUCP> Date: 16 Dec 87 20:46:29 GMT References: <10875@brl-adm.ARPA> Reply-To: pardo@uw-june.UUCP (David Keppel) Organization: U of Washington, Computer Science, Seattle Lines: 18 >why: > exit(main(argc,argv,env)) Guesses: The C compiler (or the loader, or whatever) guarantees that there is some function called "main" that is the thing you want to execute first. Main is defined as returning an int, so exit() gets an int. Therefore this code can set up whatever it needs, call main, and then exit with whatever status code main exited with. This would be like status = main(argc,argv,envp); exit(status); but doesn't use an extra variable. ;-D on (Well it _sounded_ like a good idea at the time!) Pardo