DragonFly BSD
DragonFly submit List (threaded) for 2004-01
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: patch to un-K&R-ify libkern


From: Dave Cuthbert <dacut@xxxxxxxxxxxxx>
Date: Tue, 27 Jan 2004 14:24:54 -0500

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




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