Subject: Re: a new KNF (and some comments)
To: der Mouse <mouse@rodents.montreal.qc.ca>
From: Peter Seebach <seebs@plethora.net>
List: tech-misc
Date: 01/25/2000 12:40:23
In message <200001251837.NAA20575@Twig.Rodents.Montreal.QC.CA>, der Mouse write
s:
>[Replies to multiple messages here.]
>> For example, a function
>> 	f1(short arg) { /* ... */ }
>> will not link correctly with K&R style compiler, while
>> 	f2(arg) short arg; { /* ... */ }
>> will.

>Not necessarily; there's no guarantee that any two different compilers
>are compatible in any respect.

True enough.  ;-)

>If we want to be ANSI, you simply can't do that; an f2-style definition
>is incompatible with an "f2(short);" prototype.

Correct.

>gcc
>allows it as an extension, but it does so by, effectively, rewriting
>the definition as a prototype-style definition, which breaks all the
>things that an f1-style definition would break anyway.

Yup.  And, since we currently use prototypes in headers, the only reason any
K&R stuff works at all is that gcc tends to be forgiving.  ;)

-s