Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Dec 2001 10:44:12 +0200
From:      Ruslan Ermilov <ru@FreeBSD.org>
To:        babkin@FreeBSD.org
Cc:        Mark Murray <mark@grondar.za>, 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:  <20011220104412.C67452@sunbay.com>
In-Reply-To: <3C1FEEA9.EEE89A7@bellatlantic.net>
References:  <XFMail.011216160443.jhb@FreeBSD.org> <200112180848.fBI8mvO00685@grimreaper.grondar.org> <3C1FEEA9.EEE89A7@bellatlantic.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Dec 18, 2001 at 08:34:33PM -0500, Sergey Babkin wrote:
> 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.
> 
It's perfectly legal in a free-standing environment.


Cheers,
-- 
Ruslan Ermilov		Oracle Developer/DBA,
ru@sunbay.com		Sunbay Software AG,
ru@FreeBSD.org		FreeBSD committer,
+380.652.512.251	Simferopol, Ukraine

http://www.FreeBSD.org	The Power To Serve
http://www.oracle.com	Enabling The Information Age

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?20011220104412.C67452>