From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: void main Date: Thu, 15 May 1997 23:40:36 +0000 Organization: Two pounds of chaos and a pinch of salt Lines: 46 Message-ID: <337B9EF4.5177@cs.com> References: <199705132323 DOT AA168155813 AT typhoon DOT rose DOT hp DOT com> Reply-To: fighteer AT cs DOT com NNTP-Posting-Host: ppp101.cs.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Andrew Crabtree wrote: > > Not that quoting from the standard shouldn't be enough to convince > people that "void main ..." in non-ansi compliant, here is the output > from a recent gcc snapshot I also like referring people to "comp.lang.c Frequently Asked Questions" at . It's about as official as you can get, short of reading the actual ANSI standard, and it even includes references so you can do just that. It makes for some enlightening reading. > ptest.c has > > void main(){} > > compiled with gcc -pedantic > > ptest.c: In function `main': > ptest.c:1: warning: return type of `main' is not `int' > > It does still allow you to just type "main" and have it default to int > without issuing a warning if only -pedantic is specified. I dislike this sort of thing, because it still seems like you're playing games with the compiler to save four characters worth of typing. If you program as much as I do, those extra four characters aren't going to contribute significantly to the onset of carpal tunnel syndrome. ;) I also think that you should explicitly declare the void arglist. That's another four to six characters, depending on your coding style. In fifty-thousand line programs, does it _really_ matter? int main( void ) int main( int, char ** ) Those are the only two ANSI-compliant ways to declare main(). Period. Even in C++. Those who think otherwise should pull their noses out of the sky and try reading the standards. hth! -- --------------------------------------------------------------------- | John M. Aldrich, aka Fighteer I | mailto:fighteer AT cs DOT com | | Descent 2: The Infinite Abyss - The greatest Internet game of all | | time just got better! This time, you're going all the way down...| ---------------------------------------------------------------------