Subject: Re: a new KNF (and some comments)
To: None <tech-misc@netbsd.org, tech-kern@netbsd.org>
From: Peter Seebach <seebs@plethora.net>
List: tech-kern
Date: 01/20/2000 22:50:41
In message <200001210155.KAA12199@icnmp9.icg.tnr.sharp.co.jp>, ITOH Yasufumi wr
ites:
>If we switch to ANSI style, we cannot ensure the binaries
>are linkable by other binaries generated by K&R compiler or
>from K&R style code any longer.
On the other hand, if we don't, we're taking a measurable performance hit
on the few functions affected. Note that very few functions are affected...
But for those, compilers are likely smart enough to implement them better
if given the choice of ignoring the "default promotions".
>We do not require to distribute source code (user may not change
>the binaries), and we can not force user to use ANSI style (our
>toolchain supports K&R style), it may cause compatibility problems.
I suspect they will be very rare - and I suspect a wrapper library could
be written; users with K&R compilers could link
-lknr
and be done.
>The simplest way to avoid this sort of problem is
>to use K&R style (with ANSI prototypes --- current style :-),
>in my thought.
Unfortunately, this is actually *forbidden* by the spec, and can produce
unreliable behavior.
There is, at this point, little reason for anyone to use a K&R toolchain;
the language has been different for about 15 years. K&R is even less
supported now than it used to be.
-s