From mboxrd@z Thu Jan 1 00:00:00 1970 Message-Id: <200104241743.NAA06070@egyptian-gods.MIT.EDU> To: 9fans@cse.psu.edu Subject: Re: [9fans] the declaration of main() In-Reply-To: Your message of "Tue, 24 Apr 2001 09:02:35 GMT." <3AE4B6C2.28D1E595@arl.army.mil> From: Greg Hudson Date: Tue, 24 Apr 2001 13:43:55 -0400 Topicbox-Message-UUID: 8e42eb12-eac9-11e9-9e20-41e7f4b1d025 > I don't understand what you're talking about. In 7th Edition Unix, > which is where exit status and stdio were first widely used, return > from main() (with or without a value) would automatically invoke the > exit() function, which in turn invoked cleanup(), which if any stdio > function was used would link with the buffer-flushing version > instead of the no-op version. Explicitly calling exit() would get > the same exit() function, the same cleanup() function, etc. rog was kind of terse, so: If you return from main, the cleanup handler will be called, but all of main's automatic variables (including the buffer you passed to setvbuf()) are no longer valid. If you explicitly call exit(), then main()'s automatic variables are still valid.