Subject: Re: a new KNF (and some comments)
To: None <seebs@plethora.net, tech-kern@netbsd.org, tech-misc@netbsd.org>
From: Chris Torek <torek@BSDI.COM>
List: tech-kern
Date: 01/21/2000 00:20:23
I think perhaps Soda-san misinterpreted my remarks. :-)  What I
said was that you must provide the promoted type as the prototype
when you use a narrow type in a K&R-style definition:

>... it's only a conflict in the cases where the promotions are
>different, but
>	int foo(s)
>		short s;
>	{
>	}
>declares foo to take an *int* argument ...

The stickiest situation is when you have a definition like this:

	int foo(parm)
		xyz_t parm;
	{
		...
	}

What is the correct prototype for foo()?  (It may depend on whether
xyz_t is an alias for an unsigned type, and in that case, it can
also depend on the relationship between the maximum values of an
"xyz_t" and an int.)

The problem is most easily solved by always using prototypes and
never using K&R definitions, but this precludes K&R-compatibility.

Chris