bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-gnulib] 03-getndelim2-c89.diff


From: Paul Eggert
Subject: Re: [Bug-gnulib] 03-getndelim2-c89.diff
Date: 24 Jul 2003 19:08:19 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Bruno Haible <address@hidden> writes:

> James Youngman wrote:
> > I'm not sure that's true :-
> 
> >      3  void voidargs1()
> >     16    voidargs1('a');
> > address@hidden:~$ gcc -Wall -W -g voidargs.c -o voidargs
> > [no error message for line 16]
> 
> I think that's a bug in gcc.

No, it's not a bug.  See section 6.5.2.2 paragraph 2 of ISO C99:

  If the expression that denotes the called function has a type that
  includes a prototype, the number of arguments shall agree with the
  number of parameters.

voidargs1 lacks a prototype, so no diagnostic is required for line 16.
The behavior is undefined, though (see paragraph 6 of the same section).

The extra compile-time check is why it's advantageous to use an
explicit (void) prototype in C.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]