Mail Archives: djgpp/1998/09/13/13:06:58
> 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 <g> .. 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.
- Raw text -