This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c/6968: functions that shouldn't accept arguments accept infinite arguments (eg; test() )


>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:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]