where do you put prototype declarations?

Rick Farris rfarris at serene.UUCP
Wed Feb 1 20:24:07 AEST 1989


In article <3449 at sdsu.UUCP> roetzhei at sdsu.UCSD.EDU (William Roetzheim) writes:

>   I may be the only one, but I like to put all of my function
> prototypes in one include file which contains only function
> prototypes.  This simplifies separate compilation and testing and
> provides me with a ready index of the program's functions (and their
> parameters).  Because my programs typically have many functions
> (hundreds), I keep the prototypes in alphabetical order within the
> file.

I used to do that, but on large projects, it's a royal pain to have
to re-make the whole thing everytime you add another function to the
prototype list.  

Now I create an include file for each source file, which includes the
function prototypes for that source file.  I call it filename.X, for
external interfaces.  Then I #include filename.X in each of the
source files that use functions from filename.C.  There's a rather
good description of the whole process in "Portable C and Unix System
Programming", by "J.E. Lapin" (actually the staff at Rabbit
Software), published by Prentice Hall.


Rick Farris   RF Engineering  POB M  Del Mar, CA  92014   voice (619) 259-6793
rfarris at serene.cts.com     ...!uunet!serene!rfarris       serene.UUCP 259-7757



More information about the Comp.lang.c mailing list