lint (was: Funny mistake)

Duane Richard LaMont lamont at uts.amdahl.com
Thu Mar 28 14:22:06 AEST 1991


In article <1991Mar24.165719.26908 at druid.uucp> darcy at druid.uucp (D'Arcy J.M. Cain) writes:
>Just a side note here.  I hardly ever prototype static functions.  I
>simply make sure that within a file a function is not used until it
>has been defined.  This in effect makes it a prototype for itself.

I thought this was a good idea too, but it didn't work for me on the
first prototyping compiler I ever used (SCO XENIX, forget the version
number).  It behaved as if I had declared the function without
prototyping it (i.e. the return type was known, but not the argument
count and types).

So I got in the habit of prototyping static functions and haven't tried 
the "self prototyping" method since.  One advantage of prototyping
everything is that I'm free to put the functions in the order I'm most
comfortable with.  Of course, this discussion wouldn't be complete without
mentioning mutual recursion.  I'm sure that's one case where Mr. Cain does
prototype static functions (note he didn't say "never" :-).

Are prototyping compilers supposed to treat a function as prototyped
following that function's definition?


Rick LaMont



More information about the Comp.lang.c mailing list