From mboxrd@z Thu Jan 1 00:00:00 1970 To: 9fans@cse.psu.edu From: "Douglas A. Gwyn" Message-ID: <3AE4B6C2.28D1E595@arl.army.mil> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit References: <20010423110853.3397219A61@mail.cse.psu.edu> Subject: Re: [9fans] the declaration of main() Date: Tue, 24 Apr 2001 09:02:35 +0000 Topicbox-Message-UUID: 8daf3b92-eac9-11e9-9e20-41e7f4b1d025 forsyth@vitanuova.com wrote: > it's unfortunately more error prone than void/exit. for instance, it was > common to forget fflush() in the presence of setbuf/setvbuf in main for an auto buffer > and worse, that sometimes `worked' (until ported). 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.