ANSI prototypes, the right choice...

Steve Summit scs at adam.mit.edu
Sat Feb 9 18:52:15 AEST 1991


In article <7708 at sugar.hackercorp.com> peter at sugar.hackercorp.com (Peter da Silva) writes:
[mixture of new-style prototype declaration and old-style definition]
>While some compilers will accept this declaration while this prototype is
>in scope, it is not portable and should at least generate a warning.

In article <15089 at smoke.brl.mil> gwyn at smoke.brl.mil (Doug Gwyn) writes:
>No, this is perfectly okay.  If Lattice C has a problem with it, it is a
>bug in Lattice C.

Not necessarily a bug, although I'd probably be annoyed by it.
Old-style declarations and definitions are both officially
obsolescent (sections 3.9.4 and 3.9.5); subject to deletion, at
X3J11's whim, in a future version of the Standard.  As the
Rationale says,

	Characterizing the old style as obsolescent is meant to
	discourage its use, and serve as a strong endorsement by
	the Committee of the new style.  It confidently expects
	that approval and adoption of the prototype style will
	make it feasible for some future C Standard to remove the
	old syntax.

K&R2 additionally asserts (p. 202) that "Mixtures are to be
avoided if possible."  Since compilers may issue any warning
messages they want to, I suspect that Lattice is just trying to
prod people towards the Party line.

(I'm actually not trying to defend the deprecation of the old
style; in fact I prefer that style.  Prototypes don't do anything
for me that lint doesn't do, and they're a pain to use during
transition.  But it's clear they're here to stay, so you don't
need to chastise me for being hidebound.)

                                            Steve Summit
                                            scs at adam.mit.edu



More information about the Comp.std.c mailing list