C function prototyping and large projects

Dale Gass dalegass at dalcsug.UUCP
Sun Sep 18 05:03:15 AEST 1988


My personal preference when using prototypes, is to put all the prototypes 
into one header file (proto.h, or whatever), which is included by all modules
in the project; however, I don't declare the dependency of all the source
files upon proto.h.

This avoids having to recompile *all* the modules whenever you simply add
the prototype of a new function to proto.h.  It could prove dangerous if
you *change* the syntax of the prototype in proto.h carelessly; whenver
you change a syntax in proto.h, you should 'touch *.c' to remake all
modules.  But I find in development, the ability to quickly add to proto.h
without having to recompile everything is a major time-saver.

For maintenance work on a large project, I would probably declare the
make dependency of the source files on proto.h, since modification of proto.h
(when you change the syntax of a prototyped function) could be dangerous
to existing modules (which won't be recompiled).  Howeven, when one changes
the syntax of a function, he should go through all his souces modules and
change all the references to it, anyway (in which case, those modules will
be recompiled and prototype-checked against proto.h)...

--------------

-dalegass at dalcsug
{watmath|uunet}!dalcs!dalcsug!dalegass



More information about the Comp.std.c mailing list