From owner-cvs-all Thu Dec 20 0:44:57 2001 Delivered-To: cvs-all@freebsd.org Received: from whale.sunbay.crimea.ua (whale.sunbay.crimea.ua [212.110.138.65]) by hub.freebsd.org (Postfix) with ESMTP id EAA2237B419; Thu, 20 Dec 2001 00:44:39 -0800 (PST) Received: (from ru@localhost) by whale.sunbay.crimea.ua (8.11.6/8.11.2) id fBK8iDw76753; Thu, 20 Dec 2001 10:44:13 +0200 (EET) (envelope-from ru) Date: Thu, 20 Dec 2001 10:44:12 +0200 From: Ruslan Ermilov To: babkin@FreeBSD.org Cc: Mark Murray , John Baldwin , "David O'Brien" , cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org, Luigi Rizzo , Garance A Drosihn Subject: Re: Are prototypes for main() illegal by any standard ? (was Re: Message-ID: <20011220104412.C67452@sunbay.com> References: <200112180848.fBI8mvO00685@grimreaper.grondar.org> <3C1FEEA9.EEE89A7@bellatlantic.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3C1FEEA9.EEE89A7@bellatlantic.net> User-Agent: Mutt/1.3.23i 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, 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