Sender: crough45 AT amc DOT de Message-Id: <97May10.184721gmt+0100.16645@internet01.amc.de> Date: Sat, 10 May 1997 17:51:07 +0100 From: Chris Croughton Mime-Version: 1.0 To: asu1 AT cornell DOT edu Cc: djgpp AT delorie DOT com Subject: Re: compile warning Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Precedence: bulk A. Sinan Unur wrote: > first, this is pure and simple C. in any case, void is not a valid > return type for main. Incorrect. Void is a perfectly good return type for main. > main has to return an int. No it doesn't. It only needs to generate any specific exit value if you will be using the result to test the state of the program afterwards (like in make or with the batch ERRORLEVEL). And even then it's perfectly valid to use exit(n) rather than return. Since many compilers complain if there is no return with a value from a non-void function, if the program is known to always use exit() or be non-terminating it is often better to declare main as void to get rid of the warnings. It may be considered, in some places, good /style/ to declare main as int, but that's a long way from it being an absolute. Even with -Wall -ansi -pedantic I can't get gcc to complain about void main... Chris