public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: Terry Moreland <tmorelan@q.cis.uoguelph.ca> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, Subject: Re: c/6968: functions that shouldn't accept arguments accept infinite arguments (eg; test() ) Date: Fri, 07 Jun 2002 23:56:00 -0000 [thread overview] Message-ID: <20020608065601.24744.qmail@sources.redhat.com> (raw) The following reply was made to PR c/6968; it has been noted by GNATS. From: Terry Moreland <tmorelan@q.cis.uoguelph.ca> To: zack@gcc.gnu.org, <gcc-bugs@gcc.gnu.org>, <gcc-prs@gcc.gnu.org>, <nobody@gcc.gnu.org>, <gcc-gnats@gcc.gnu.org> Cc: Subject: Re: c/6968: functions that shouldn't accept arguments accept infinite arguments (eg; test() ) Date: Sat, 8 Jun 2002 02:44:36 -0400 (EDT) I might be reading this wrong but does not: 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) ( ISO 9899:1999 Section 6.7.5.3 Paragraph 14 ) mean that in c99 void test() is a function that takes no arguments since enmpty identifier list is part of the function definition and as such the void test() example should produce an error in c99, but doesn't in gcc 3.1 using -std=c99 please let me know if I am wrong, I have slept in a while and the iso c99 spec can be very wordy at times the reference 124 leads to 6.11.6 which mentions: The use of function declarators with empty parentheses (not prototype-format parameter type declarators) is an obsolescent feature. Terry On 8 Jun 2002 zack@gcc.gnu.org wrote: > Synopsis: functions that shouldn't accept arguments accept infinite arguments (eg; test() ) > > State-Changed-From-To: open->closed > State-Changed-By: zack > State-Changed-When: Fri Jun 7 22:56:53 2002 > State-Changed-Why: > This is not a bug. The C standard specifies that a > function declared with an empty parameter list (such > as your void test ( ) ) accepts an indefinite number > of arguments, not zero arguments. You must write > void test ( void ) if you want to declare a function > accepting zero arguments. > > (You may have C confused with C++. In C++ the rule > is as you expected.) > > http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6968 > -- -------------------------------------------------------- Terry Moreland | Computer and Information Science tmorelan@uoguelph.ca | University of Guelph If you were plowing a field, which would you rather use? Two strong oxen or 1024 chickens? - Seymour Cray (1925-1996), father of supercomputing --------------------------------------------------------
next reply other threads:[~2002-06-08 6:56 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2002-06-07 23:56 Terry Moreland [this message] -- strict thread matches above, loose matches on Subject: below -- 2002-06-08 12:46 Terry Moreland 2002-06-08 2:46 Joseph S. Myers 2002-06-07 22:56 zack 2002-06-07 18:16 tmorelan
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=20020608065601.24744.qmail@sources.redhat.com \ --to=tmorelan@q.cis.uoguelph.ca \ --cc=gcc-prs@gcc.gnu.org \ --cc=nobody@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: linkBe 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).