Date: Tue, 18 Dec 2001 20:34:33 -0500 From: Sergey Babkin <babkin@bellatlantic.net> To: Mark Murray <mark@grondar.za> Cc: John Baldwin <jhb@FreeBSD.org>, "David O'Brien" <obrien@FreeBSD.org>, cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org, Luigi Rizzo <rizzo@aciri.org>, Garance A Drosihn <drosih@rpi.edu> Subject: Re: Are prototypes for main() illegal by any standard ? (was Re: Message-ID: <3C1FEEA9.EEE89A7@bellatlantic.net> References: <XFMail.011216160443.jhb@FreeBSD.org> <200112180848.fBI8mvO00685@grimreaper.grondar.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Mark Murray wrote:
>
> This I do not understand. :-)
>
> AFAIK, this is perfectly legal C:
>
> /* begin */
> void printf(char *, ...)
>
> void main(void)
> {
> printf("Hello world");
> }
> /* end */
>
> And it should compile warning-free and run without error. Agreed
> that the style sucks, but it is _legal_ - and any compiler's prior
No, it's completely wrong. The return type of main() is int.
Otherwise you get garbage for the exit code.
-SB
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3C1FEEA9.EEE89A7>
