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: Joerg Sonnenberger <joerg@xxxxxxxxxxxxxxxxx>
Date: Tue, 27 Jan 2004 19:53:20 +0100

On Tue, Jan 27, 2004 at 10:23:27AM -0800, Matthew Dillon wrote:
> 
> :Joerg Sonnenberger wrote:
> :> Commited. Thanks. The addition of (void) to empty_loop() and co
> :> is unnecessary.
> :
> :?
> :
> :In C (but not C++), "void empty_loop()" is a function taking any number 
> :of args, equivalent to "void empty_loop(...)"; the (void) addition 
> :prohibits arguments from being passed.  Presumably, this matches a 
> :header somewhere?  (Though I didn't see it in the patch.)
> 
>     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()
{
}
or so. and in this case the void is clearly unnecessary, if my understanding
of the ISO C99 specs is correct. The "(void)" is only needed for the
parameter list and therefore for protyps and function types. 

Joerg

>     So the void should be in there if the idea is to un-K&R-ify the code.
> 
> 					-Matt
> 					Matthew Dillon 
> 					<dillon@xxxxxxxxxxxxx>



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