Subject: Re: K&R vs. ANSI call conventions (was Re: a new KNF)
To: Todd Vierling <tv@pobox.com>
From: Richard Earnshaw <rearnsha@arm.com>
List: tech-toolchain
Date: 02/17/2000 16:09:18
> On Fri, 18 Feb 2000, Noriyuki Soda wrote:
> 
> : But changing functions to ANSI style makes examination by "gcc -pendantic"
> : impossible. This is the problem, since number of library functions 
> : continuously increase.
> 
> I don't understand this statement.  If we use ANSI function definitions, the
> code in /usr/lib/*.so WILL NOT CHANGE.  Programs outside the libraries see
> only ANSI prototypes.  What, then, breaks using gcc -pedantic?
> 

I'm guessing here, but I suspect the intention is that by turning on 
-pedantic, we will get a warning/error if a non-K&R promoted argument is 
used in the function's definition; that is

int foo (float);

int foo (f)
  float f;
{
}

will generate an error/warning if compiled with -pedantic.  Without the 
flag, gcc will silently massage the K&R declaration into an ANSI one so 
that caller and callee will match (this is a gcc extension).  This looks 
like something that probably should be warned about with -wtraditional 
(though it appears not to be at the moment).

Richard.