Subject: Re: proposed new KNF [was Re: Time to update KNF?]
To: None <chopps@merit.edu>
From: Chris Torek <torek@BSDI.COM>
List: tech-kern
Date: 01/18/2000 19:30:28
>If you used k&r definitions the compiler assumed arguments where passed
>as ints unless larger ...

Ah, this is a different problem entirely -- it has nothing to do
with the __P macro per se.

If you define a function using an old-style (K&R) definition:

	int foo(a, b, c)
		char a;
		short b;
		float c;
	{
		...
	}

then the correct prototype is:

	int foo(int a, int b, double c);

Things get even stickier in ANSI C if you use narrow unsigned
types, which widen either to signed wider types or unsigned
wider types, i.e., WIDEN("unsigned short") is either "signed int"
or "unsigned int", depending on whether USHRT_MAX > INT_MAX.
On the PDP-11, USHRT_MAX would be 65535 and INT_MAX would be
32767, so "unsigned short" would widen to "unsigned int", while
on the VAX, i386, etc., INT_MAX is 2147483647, so it widens to
(plain, signed) int.

This is a royal mess and yet another argument for using only
prototype syntax everywhere, if you ask me -- but it is independent
of the weird syntax of __P.

Chris