Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!elroy.jpl.nasa.gov!jato!mars!kaleb From: kaleb@mars.jpl.nasa.gov (Kaleb Keithley) Newsgroups: comp.lang.c Subject: Re: main() arguments, was Re: typedef-ing an array Message-ID: <4254@jato.Jpl.Nasa.Gov> Date: 6 Jul 90 01:00:47 GMT References: <4238@jato.Jpl.Nasa.Gov> <25273@mimsy.umd.edu> <4241@jato.Jpl.Nasa.Gov> <2160@polari.UUCP> <4249@jato.Jpl.Nasa.Gov> <1990Jul5.221205.19888@dg-rtp.dg.com> Sender: news@jato.Jpl.Nasa.Gov Reply-To: kaleb@mars.UUCP (Kaleb Keithley) Organization: Jet Propulsion Laboratory, Pasadena, CA. Lines: 39 In article <1990Jul5.221205.19888@dg-rtp.dg.com> goudreau@larrybud.rtp.dg.com (Bob Goudreau) writes: > >In article <4249@jato.Jpl.Nasa.Gov>, kaleb@mars.jpl.nasa.gov (Kaleb >Keithley) writes: >> >> It also strikes me that what may be missing from the standard is a statement >> along the lines of "... use of exit() from main() is illegal..." Not to >> mention that K&R2 is a little misleading in this area also. > >Say what? Who has ever claimed that use of exit() from main() is not >legal? I don't think anyone ever said it was illegal. By implication I was trying to state that the use of exit() from (ANSI Std. C defined): int main(int argc; char **argv) { ... } was inconsistant. Maybe I'm picking nits, but main() should use return instead of exit based on this. If the ANSI Std. is going to define a the way that main() is declared, then they should define the corresponding exit (not the funcion) from function main(). And IMHO, return is the correct exit method from int main(). if main() is defined as returning a value of type int, then the use of exit is not consistant with the defined return value of the function. It's just a matter of style, I suppose, but in all of my code, my main() usually has just three statements, initialize(), process(), clean_up(). If exit() is appropriate, then it is called close to the the event that requires it, so exit() from main() would be overkill. Furthermore, had you read my (and others) previous posting on this subject, you'd have seen my reference to K&R2 that stated that exit() from main() and return from main() were equivalent. kaleb@thyme.jpl.nasa.gov Jet Propeller Labs Kaleb Keithley "So that's what an invisible barrier looks like"