Mail Archives: djgpp/1997/06/10/14:21:18
Darren Grant (darn AT xl DOT ca) wrote:
: George Foot wrote:
: >
: > Darren Grant (darn AT xl DOT ca) wrote:
: >
: > : void main();
: >
: > This is wrong. In C++ the main function absolutely must return an int;
: > the strict type checking in C++ makes this very important. gcc
: > automatically switches the prototype to return int, but you ought to
: > declare it to return int explicitly yourself, and return a value.
: Thanks for poiting that out, but which C++ compilers choke on the void
: return?
To be fair, I don't know of any which by default stop execution, although
I haven't used many different ones (my time in TC lasted only until I
discovered DJGPP). However, it is illegal according to the ANSI standard
for C and the proposed standard for C++. If you want more information, try
the comp.lang.c FAQ (FTP from rtfm.mit.edu, or see the online HTML version
at http://www.eskimo.com/~scs/C-faq/top.html).
--
George Foot <mert0407 AT sable DOT ox DOT ac DOT uk>
Merton College, Oxford
- Raw text -