Date: Sun, 13 Sep 1998 13:04:21 -0400 (EDT) Message-Id: <199809131704.NAA03113@delorie.com> From: DJ Delorie To: sl AT psycode DOT com DOT REMOVE_THIS CC: djgpp AT delorie DOT com In-reply-to: (sl AT psycode DOT com DOT REMOVE_THIS) Subject: Re: DJGPP/GCC bug found Precedence: bulk > I'm unsure who is to blaim for the following bug, but here it is: Apparently, you must blame your teacher. > In the above example, the compiler complains "return;" is used in a > case where "main()" is non-void.. But as you can see, it IS declared > to return void! Anyway, I am using DJGPP 2.1 with GCC 2.8.1.. Try and main returns int, regardless of what you put in your source code. That's the standard, and gcc knows it. main is a special function that has certain well-known semantics in C and C++ and you can't just do what you want with it. Since main returns an int, gcc will complain if you return anything else (or return nothing). > compile the code yourself. You will get the same results.. As for why > I am using "void main", I am not; this code was provided to me by my > teacher, so go blaim him .. I know better .. OK, it's your teacher's bug. Tell him/her that he/she is WRONG and that main MUST return an int to be correct.