Subject: Re: proposed new KNF [was Re: Time to update KNF?]
To: der Mouse <mouse@Rodents.Montreal.QC.CA>
From: Luke Mewburn <lukem@cs.rmit.edu.au>
List: tech-kern
Date: 01/18/2000 16:13:25
der Mouse writes:
> Quite aside from whether I like this proposed KNF (I don't, on many
> counts, on most of which I equally dislike the current KNF), I see some
> internal inconsistencies.

well, i stuffed up...

> > static char	*function(int, int, float, int);
> 
> > 	struct	foo	*next;		/* List of active foo */
> 
> > static char *
> > function(int a1, int a2, float fl, int a4)
> 
> > 	int		*six, seven;
> > 	char		*eight, *nine, ten, eleven, twelve, thirteen;
> > 	char		 fourteen, fifteen, sixteen;
> 
> Why does the * attach to the variable name in variable declarations,
> but behave like part of the type name in function declarations?  That
> is, why isn't the function
> 
> static char
> *function(int a1, int a2, float fl, int a4)

one of the main reasons for
	
	static char *
	foo( ... )

is that you can find where a function is defined by using
	grep '^foo' *.c

or, at least, that's what i believe the reason to be.


> > void
> > function(int a1, int a2)
> 
> But you advised using __P for declarations for the sake of old
> compilers.  If you're writing prototype definitions, there's no reason
> to be generous to old compilers in the declarations, since the code
> won't build on a pre-prototype compiler anyway.

use __P in *public* header files. (e.g, in <stdlib.h>). it doesn't
matter for private stuff.

> > static void
> > usage()
> 
> If you do prototype definitions (as above), why no prototype here?

i stuffed up usage() and main(). they both should be in ANSI C.