Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Dec 2001 16:46:08 +0100 (CET)
From:      Harti Brandt <brandt@fokus.gmd.de>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        Erik Trulsson <ertr1013@student.uu.se>, 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:  <20011218164331.F414-100000@beagle.fokus.gmd.de>
In-Reply-To: <20011219023054.I4779-100000@gamplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011218164331.F414-100000>