Protoize/Unprotoize (was: ANSI C to K&R syntax converter)

Karl Heuer karl at haddock.ima.isc.com
Thu Jun 7 02:08:35 AEST 1990


In article <5160 at stpstn.UUCP> lerman at stpstn.UUCP (Ken Lerman) writes:
>In article <1645 at mountn.dec.com> minow at thundr.enet.dec.com (Martin Minow) writes:
>>[Use a macro to get prototyped declarations conditional on __STDC__, but
>>continue to use the obsolescent syntax for function definitions]
>
>Sorry, Martin, but IMHO that is not correct.  I don't have my copy of
>the Standard handy, but the last time I tried that (or something like
>that) I found that the DG Avvion (Greenhills) C compiler either
>complained or generated bad code (I forget which) if a function was
>declared with ANSI prototypes and defined without them.

This is true in the case of formal parameters (e.g. char, float) that are
subject to promotion (see the FAQ list for the reason), but for functions with
no promotable arguments (this includes the entire standard library) there
should not be any such restriction.  As I recall, the Committee intentionally
allowed it, to make it easier to upgrade old code with new headers.

Karl W. Z. Heuer (karl at ima.ima.isc.com or harvard!ima!karl), The Walking Lint



More information about the Comp.lang.c mailing list