patch to un-K&R-ify libkern

Joerg Sonnenberger joerg at britannica.bec.de
Tue Jan 27 11:29:45 PST 2004


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 at xxxxxxxxxxxxx>





More information about the Submit mailing list