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 20:28:41 +0100

On Tue, Jan 27, 2004 at 11:07:45AM -0800, Matthew Dillon wrote:
> 
> :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
> 
>     They might have done something funny in the C99 spec, but as far as I
>     know you want the void in there or it's not an ANSI function definition.
>     It doesn't really matter for void args, I guess, but we should be 
>     consistent and generally that means using the void fubar(void) form
>     in our codebase.

There is even a precidence in style(9) if you grep for usage().
The code should look like:

static void	usage(void);

/* many useful code */

static void
usage()
{
}

Does this illustrate the two different forms of declaration?
For the prototyp the (void) is needed to distinguish it from K&R,
but the later form is valid and identical for both.

Joerg

> 					-Matt
> 					Matthew Dillon 
> 					<dillon@xxxxxxxxxxxxx>



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