public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: tmorelan@uoguelph.ca
To: gcc-gnats@gcc.gnu.org
Subject: c/6968: functions that shouldn't accept arguments accept infinite arguments (eg; test() )
Date: Fri, 07 Jun 2002 18:16:00 -0000	[thread overview]
Message-ID: <20020608011354.22212.qmail@sources.redhat.com> (raw)


>Number:         6968
>Category:       c
>Synopsis:       functions that shouldn't accept arguments accept infinite arguments (eg; test() )
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          accepts-illegal
>Submitter-Id:   net
>Arrival-Date:   Fri Jun 07 18:16:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Terry Moreland
>Release:        2.95, 2.96, 3.1
>Organization:
>Environment:
Debian Linux (Potato)
Redhat Linux 7.2 (base install) glibc 2.2.2-10
Redhat Linux 7.3 (base install) glibc 2.2.5
>Description:
a function declared as taking no arguments accepts infinite arguments without complaint under -Wall -ansi -pedantic or any other standard 

eg;
void test( ) {
  printf("shouldn't compile\n");
}

int main(void) {
  test( 1, 2, 3, "Hello", "World", "this", "shouldn't", "compile" );
  return(0);
}

above code compiles and runs without error
>How-To-Repeat:
sample code:

#include <stdio.h>

void test( ) {
  printf("shouldn't compile\n" );
}

int main(void) {
  test( 1, 2, 3, "Hello", "World" );
  return(0);
}
>Fix:
change prototype of function that shouldn't accept arguments
to use void as argument

eg;
void test(void);
>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2002-06-08  1:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-07 18:16 tmorelan [this message]
2002-06-07 22:56 zack
2002-06-07 23:56 Terry Moreland
2002-06-08  2:46 Joseph S. Myers
2002-06-08 12:46 Terry Moreland

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=20020608011354.22212.qmail@sources.redhat.com \
    --to=tmorelan@uoguelph.ca \
    --cc=gcc-gnats@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).