This is the mail archive of the gcc@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]

Re: -Wstrict-prototypes and void foo () {}


Richard Henderson writes:
 > On Mon, May 05, 2003 at 03:30:11PM -0700, Doug Evans wrote:
 > > Having to go and change lots of function definitions from
 > ...
 > > -foo ()
 > > +foo (void)
 > ...
 > > is a pain _and_ an eyesore.
 > 
 > No, I don't think we can: foo() *isn't* a prototype in C.
 > Which means that you won't get any diagnostic for "foo(3)".

Obviously no claim is made that "void foo ();" is a prototype.
Note the semicolon.

However, it's kinda hard to believe gcc doesn't know how many
parameters are in its definition though. :-)

void foo () {}

I was kinda hoping gcc would minimize the damage due to this
language workaround of this snafu in K&R C, not generalize it.

I don't care what happens with

void foo (a) int a; {}

[deprecate it as much as possible would be my vote]

But how much existing practice is there to doing

void foo () { /* this function has no arguments */ }

when one is writing function definitions in ANSI C? (so to speak)
Seems to me it's S.O.P.


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