From owner-cvs-all Tue Dec 18 7: 1: 7 2001 Delivered-To: cvs-all@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id C483A37B405; Tue, 18 Dec 2001 07:00:53 -0800 (PST) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id BAA02249; Wed, 19 Dec 2001 01:59:44 +1100 Date: Wed, 19 Dec 2001 02:01:01 +1100 (EST) From: Bruce Evans X-X-Sender: To: Mark Murray Cc: John Baldwin , "David O'Brien" , , , Luigi Rizzo , Garance A Drosihn Subject: Re: Are prototypes for main() illegal by any standard ? (was Re: In-Reply-To: <200112180848.fBI8mvO00685@grimreaper.grondar.org> Message-ID: <20011219014745.N4646-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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