From owner-cvs-all Tue Dec 18 7:46:24 2001 Delivered-To: cvs-all@freebsd.org Received: from mailhub.fokus.gmd.de (mailhub.fokus.gmd.de [193.174.154.14]) by hub.freebsd.org (Postfix) with ESMTP id C2A5937B405; Tue, 18 Dec 2001 07:46:16 -0800 (PST) Received: from beagle (beagle [193.175.132.100]) by mailhub.fokus.gmd.de (8.11.6/8.11.6) with ESMTP id fBIFk8506611; Tue, 18 Dec 2001 16:46:08 +0100 (MET) Date: Tue, 18 Dec 2001 16:46:08 +0100 (CET) From: Harti Brandt To: Bruce Evans Cc: Erik Trulsson , Mark Murray , 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: <20011219023054.I4779-100000@gamplex.bde.org> Message-ID: <20011218164331.F414-100000@beagle.fokus.gmd.de> 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 Wed, 19 Dec 2001, Bruce Evans wrote: BE>On Tue, 18 Dec 2001, Harti Brandt wrote: BE> BE>> To come back to the subject: you agree, that the compiler does not supply BE>> a prototype to main (having knowledge about main is not the same as BE>> prototyping main()). So, if we use compiler options to give us a warning, BE>> whenever a function is used/defined without a prototype and to turn BE>> warnings into errors, every program, which does NOT prototype main() BE>> should give us an error. So the right thing to do if we want those errors BE>> is to prototype main(). BE> BE>I think there should only be a warning for the case where main() is BE>completely unprototyped (not when it is implicitly prototyped by BE>defining it using an old-style parameter lis). The warning controlled BE>by -Wmissing-prototypes is negatively useful for main(), since it is BE>"to detect global functions that fail to be declared in header files", BE>but main() can't be declared in standard header files and declaring BE>it in program header files is only useful for strange programs that BE>call main() recursively. That makes sense. Seeing someone prototyping main() makes me always thinking he is going to make something unusal. harti -- harti brandt, http://www.fokus.gmd.de/research/cc/cats/employees/hartmut.brandt/private brandt@fokus.fhg.de To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message