From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28558 invoked by alias); 13 Jul 2006 17:53:12 -0000 Received: (qmail 28550 invoked by uid 22791); 13 Jul 2006 17:53:12 -0000 X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.45.12) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 13 Jul 2006 17:53:09 +0000 Received: from stewie.corp.google.com (stewie.corp.google.com [172.24.0.49]) by smtp-out.google.com with ESMTP id k6DHr3T1000829; Thu, 13 Jul 2006 10:53:03 -0700 Received: from dhcp-172-18-108-229.corp.google.com.google.com (dhcp-172-18-108-229.corp.google.com [172.18.108.229]) (authenticated bits=0) by stewie.corp.google.com with ESMTP id k6DHqwWm031385 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 13 Jul 2006 10:52:58 -0700 To: florin@iucha.net (Florin Iucha) Cc: gcc-help@gcc.gnu.org Subject: Re: implicit void arguments not checked? References: <20060713120633.GR17890@iucha.net> <20060713174545.GS17890@iucha.net> From: Ian Lance Taylor Date: Thu, 13 Jul 2006 17:53:00 -0000 In-Reply-To: <20060713174545.GS17890@iucha.net> Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2006-07/txt/msg00172.txt.bz2 florin@iucha.net (Florin Iucha) writes: > > No. In C, "void fn()" means that you are not saying anything about > > the arguments accepted by the function. As you mentioned, the way to > > say that a function takes no arguments is "void fn(void)". > > I knew that from K&R, but I was expecting ANSI C90 and C99 to tighten > that up a bit. Otherwise, what would be the point of having function > declaration at all? Only for the return type? C90 introduced function prototypes, but they had to be backward compatible. So they decided that fn() says nothing about argument types. Otherwise they would have broken all existing K&R C code. > Do you have a hard reference (to the standard)? C99 6.7.5.3 paragraph 14: An identifier list declares only the identifiers of the parameters of the function. An empty list in a function declarator that is part of a definition of that function specifies that the function has no parameters. The empty list in a function declarator that is not part of a definition of that function specifies that no information about the number or types of the parameters is supplied.(124) Footnote 124: See ``future language directions'' (6.11.6). 6.11.6: The use of function declarators with empty parentheses (not prototype-format parameter type declarators) is an obsolescent feature. Ian