Subject: Re: Style guide
To: None <current-users@NetBSD.ORG>
From: Simon J. Gerraty <sjg@quick.com.au>
List: current-users
Date: 05/29/1997 16:47:35
Peter Seebach writes:
>In ANSI mode, we declare unvis(3) as
> int unvis(char *, char, int *, int);
>but the actual library declaration is
> int unvis(a, b, c, d)
> char *a;
> char b;
> int *c;
> int d;
This is indeed incorrect.
>This is Wrong. Now, it may be that the mistake was dmr's decision
>to have default promotions. It may be DEC's fault for making an
>architecture where they made sense. It may be ISO's for the non-promoting
>prototypes.
Or the misstake could be that of the programmer that thought there was
some advantage in using char b rather than int b.
I've always hated seeing code that uses sub-int's as iterators for
instance just because the programmer thought he'd never have to count
past 100. The fact that some poor cpu might have to execute 10 times
the number of instructions cf. using an int is ignored.
I've always taken the attitude that sub-ints are mainly for dealing
with the out-side (real) world, and that where object size does
not matter an int should be used as that is what the implementation
is (or should be) optimized for.
Of course I'm probably old fasioned...
:-)