Subject: Re: a new KNF (and some comments)
To: None <tech-kern@netbsd.org, tech-misc@netbsd.org>
From: Peter Seebach <seebs@plethora.net>
List: tech-misc
Date: 01/21/2000 00:22:50
In message <200001210533.OAA04917@srapc342.sra.co.jp>, Noriyuki Soda writes:
>It is not so rare, programmers who don't understand default promotion
>might easily produce this kind of problems.
>And because this is ABI issue, the wrapper library maitanance is too
>hard to do. I think K&R style is far easy to keep ABI.

I suppose, but it is inefficient and obsolete.

>Which spec?
>As Chris Torek wrote in Message-Id: <200001190230.TAA19047@forge.BSDI.COM>,
>K&R style and ANSI prototype is no problem from ANSI/ISO-C standard POV.

I'd have to disagree with Chris.  I don't do this lightly, but I'm pretty
sure that it's a conflict.  Of course, 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, for purposes of the rest of the code.

If, elsewhere, you say
	int foo(short);
you are allowed to be using different calling conventions.

Disclaimer:  Only a fool would disagree with Chris Torek without admitting
the possibility that he's wrong.  That said, I *am* on the ISO committee,
and I'm pretty sure I understand these rules.  If anyone wants, I can go
look it up in either C89 or C99.  (I have C99, even though I'm not sure it's
for sale yet.  Nyah nyah.)  However, I'm not looking it up tonight, I'm
going to bed now.  ;-)

-s