Mail Archives: djgpp/1997/08/09/15:37:04
Korenschi Francisc Eduard wrote:
>
> Hello from Romania,
>
> What does the message "Return type for main changed to integer type"
> mean ?
> (I used the -Wall option)
'void', or any other type, is not a legal return type for main().
According to the ANSI standard, main() must always return an integer.
In C, this isn't such a big issue for the compiler (it's still wrong!),
but in C++, it's so important that the compiler will automatically
convert the type to int if you don't specify it that way yourself. When
you turn on all warnings, it mentions this.
BTW, the issue of void main() is discussed at length in the comp.lang.c
Frequently Asked Questions at
http://www.eskimo.com/~scs/C-faq/top.html. Look at questions 11.12
through 11.16. The FAQ also gives complete ANSI references by section
number.
--
John M. Aldrich <fighteer AT cs DOT com>
* Anything that happens, happens.
* Anything that, in happening, causes something else to happen,
causes something else to happen.
* Anything that, in happening, causes itself to happen again, happens
again.
* It doesn't necessarily do it in chronological order, though.
--- Douglas Adams
- Raw text -