Mail Archives: djgpp/1997/07/04/02:54:54
Erik Max Francis wrote:
>
> Giovanni Resta wrote:
>
> > I always declared main as void in the past 5 years and
> > I never get an error, so I'm curious about the topic.
> > (I must admit that I never had to test the 'exit code' of a program,
> > maybe that can change things)
>
> There are only two valid ANSI C prototypes for main:
>
> int main(void);
> int main(int argc, char *argv[]); /* the names of the arguments can
> vary, of course */
>
> This is clearly indicated in section 5.1.2.2.1 of the ANSI C standard.
>
also, the draft C++ standard only specifies that the return type of main
shall be int and it should support at least the two froms given above.
so to be conforming, you must use int main (at least for hosted
applications.)
--
Sinan
*******************************************************************
A. Sinan Unur WWWWWW
|--O+O
mailto:sinan DOT unur AT cornell DOT edu C ^
http://www.people.cornell.edu/pages/asu1/ \ ~/
Unsolicited e-mail is _not_ welcome, and will be billed for.
*******************************************************************
- Raw text -