Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!ucsd!tut.cis.ohio-state.edu!pt.cs.cmu.edu!andrew.cmu.edu!ghoti+ From: ghoti+@andrew.cmu.edu (Adam Stoller) Newsgroups: comp.lang.c Subject: Re: main() [exit vs. return] Message-ID: <4aZDy6i00Vtq8qIVAw@andrew.cmu.edu> Date: 6 Jul 90 21:15:50 GMT References: <4238@jato.Jpl.Nasa.Gov> <25273@mimsy.umd.edu> <4241@jato.Jpl.Nasa.Gov> <2160@polari.UUCP> <4249@jato.Jpl.Nasa.Gov>, <306@taumet.com> Organization: Information Technology Center, Carnegie Mellon, Pittsburgh, PA Lines: 17 In-Reply-To: <306@taumet.com> Excerpts from netnews.comp.lang.c: 6-Jul-90 Re: main() arguments, was R.. Stephen Clamage@taumet.c (965) > "A return from the initial call to the _main_ function is equivalent to > calling the _exit_ function with the value returned by the _main_ function as its argument." If one uses exit() [with argument EXIT_SUCCESS (?)] - I believe ANSI specifies that any functions that were registered via the atexit() function should be called prior to the final termination of the program. If one uses return from main() do the functions registered with atexit() get called ? (i.e. just how equivelent are they?) --fish [return(exit(0));]