Subject: Re: K&R vs. ANSI call conventions (was Re: a new KNF)
To: None <tv@pobox.com>
From: Noriyuki Soda <soda@sra.co.jp>
List: tech-toolchain
Date: 02/17/2000 23:47:42
> ...Which means that we won't break the ABI of shlibs (the original thread
> supposition) by makine the NetBSD code use proper ANSI function definitions,
> as we're already depending on that by making use of a gcc extension.

As mentioned by Peter Seebach, the only function which have smaller
integral argument is htoi() in skey.h. IMHO, functions like this
should be avoided from standard library, unless there is firm reason
to do so. (i.e. htoi() had to use int rather char).

Not only such code potencially breaks ABI, but that code doesn't work
with programs which don't include header file correctly.

I don't care functions which would like to use float as argument
with firm reasons (like ANSI-C's new floating functions).
But I care functions which blindly use integral argument which is
smaller than integer (or functions which use float argument without
good reasons).
Using small integer argument doesn't make function call faster
in general, it often makes function call rather slower (although using
float argument might make function call faster). And it introduces
compatibility problem. So it is generally should be avoided in library
functions. (at least about integral types.)

BTW, using prototype declaration with K&R function definition with
integral argument smaller than int is not only GCC extension, but
almost all compiler's extention.
--
soda