Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Jens Gustedt Newsgroups: comp.lang.c Subject: Re: GCC is re-implementing in C++ and C discarded Date: Tue, 28 Aug 2012 09:07:33 +0200 Organization: A noiseless patient Spider Lines: 32 Message-ID: <503C6E35.3090905@loria.fr> References: <5ae847c6-461f-4243-86bb-5712b158b022@googlegroups.com> <7IqdnYpQqOi476vNnZ2dnUVZ_rednZ2d@giganews.com> <36a33495-6dbd-49bc-a36e-59dd1f479902@k3g2000yqo.googlegroups.com> <12c3eb3a-f1a9-493b-a58b-c572729ec037@googlegroups.com> <371dad4b-a842-42d9-9716-98b48f9a8335@googlegroups.com> <503B9FDD.3040305@verizon.net> <503BB07E.8070109@verizon.net> <8aQ_r.202661$GZ3.178925@tornado.fastwebnet.it> <503BD05A.9030804@loria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Injection-Info: mx04.eternal-september.org; posting-host="2590e4fa64e7931a8f955de6703c052f"; logging-data="12541"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19RZkTJt+qHz1HChA2bLXjQ+7xzFmROGCg=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 In-Reply-To: Cancel-Lock: sha1:RwQUTC+mXUsRqUFKHVhi7e/g5nI= Xref: csiph.com comp.lang.c:25194 Am 28.08.2012 03:16, schrieb Vincenzo Mercuri: > Il 28/08/2012 02:34, Keith Thompson ha scritto: > [..] >> Removing `main` from the debate for a moment, clearly the following >> function definition is valid: >> >> void foo() { } >> >> But does this function definition: >> >> void foo() { >> if (0) foo(42); >> } >> >> require a diagnostic? >> > > I agree with what you said. I believe that there is no way to answer to > this question, unless the Standard explicitly says that, in such cases, > "void foo() { }" also provides a prototype for `foo()'. But it says so implicitly. Prototypes are defined semantically (6.2.1p2), not through syntax: a declaration of a function that declares the types of its parameters. "void foo() { }" perfectly fits in here, it is a definition and it specifies the number and type of its parameters, namely none. Jens