Date: Wed, 19 Dec 2001 02:01:01 +1100 (EST) From: Bruce Evans <bde@zeta.org.au> 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: <20011219014745.N4646-100000@gamplex.bde.org> In-Reply-To: <200112180848.fBI8mvO00685@grimreaper.grondar.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 18 Dec 2001, Mark Murray wrote: > 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 Except for one syntax error and 2 type mismatches. > that the style sucks, but it is _legal_ - and any compiler's prior > assumed knowledge about main is plain wrong - it is a linker thing > to use ``main'' as an entry point, and nobody else's damn business > what it is after that! (argc and argv are likewise conventions that > are less useful in an embedded environment with no shell (ya, ya I > know about execv :)). > > Now if anyone can show official standards showing me that I'm > wrong here, I'll shut up and back off. :-) See other replies. Authors of "void main()" are often laughed at in comp.lang.c. Bruce 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?20011219014745.N4646-100000>