patch to un-K&R-ify libkern

Dave Cuthbert dacut at neolinear.com
Tue Jan 27 11:24:54 PST 2004


Joerg Sonnenberger wrote:
On Tue, Jan 27, 2004 at 10:23:27AM -0800, Matthew Dillon wrote:
   No.  void empty_loop(); is simply an old style K&R definition, while 
   void empty_loop(void); is an ANSI definition.

There are two different things here. For prototyps, you are absolutely
right. But this was about function declarations e.g.
void
empty_loop()
{
}
Swap the usage of definition and declaration. </pedantic>

Actually, I'm somewhat surprised that compilers accept an ANSI prototype
followed by a K&R function definition; but both gcc 3.3 and SunPro C
accept:
    void x(void);
    void x() { return; }
Both also issue a diagnostic (gcc error, SunPro warning) about:

    void x(int);
    void x() { return; }
Learn something new every day.  At any rate, I stick to the ANSI style
for my new code.
Dave






More information about the Submit mailing list