Subject: Re: C Language Standard(s)
To: None <current-users@NetBSD.ORG>
From: Peter Seebach <email@example.com>
Date: 01/09/1996 10:02:44
>> The __P has the definite down side that it looks ugly, and that in some
>> cases a compiler not-gcc may complain if the K&R style definition means
>> a different thing than the prototype;
>> int foo(short);
>> followed by
>> int foo(x)
>> short x;
>Why do you use "int foo(short);" in this case ?
>It should be "int foo(int);", because K&R style function definition
>makes short argument to be promoted to int.
>(and "int foo(short)" MAY make short argument to be passed as short, not int)
Right. The K&R style definition breaks things. .. except that some
compilers chose to ignore this when a prototype is in scope.
Doing the whole thing ANSI style guarantees the best possible chance of
being able to pass arguments of the types we want to consistently. I
am unaware of any interest in porting to platforms that don't have an ANSI
compiler available at this time, and to be honest, can't see any possible
advantage of using K&R style definitions for functions any more. Compared
to the other issues we'd face porting this code to a non ANSI environment,
it's nothing, and further, it's a sort of nothing that can be done
automatically if we want it.