From: Ian Lance Taylor <iant@google.com>
To: florin@iucha.net (Florin Iucha)
Cc: gcc-help@gcc.gnu.org
Subject: Re: implicit void arguments not checked?
Date: Thu, 13 Jul 2006 17:53:00 -0000 [thread overview]
Message-ID: <m38xmxgznq.fsf@dhcp-172-18-108-229.corp.google.com> (raw)
In-Reply-To: <20060713174545.GS17890@iucha.net>
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
prev parent reply other threads:[~2006-07-13 17:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-13 12:06 Florin Iucha
2006-07-13 15:48 ` Ian Lance Taylor
2006-07-13 17:45 ` Florin Iucha
2006-07-13 17:53 ` Ian Lance Taylor [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m38xmxgznq.fsf@dhcp-172-18-108-229.corp.google.com \
--to=iant@google.com \
--cc=florin@iucha.net \
--cc=gcc-help@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).