Path: utzoo!utgpu!water!watmath!clyde!cbosgd!osu-cis!tut!lvc
From: lvc@tut.cis.ohio-state.edu (Lawrence V. Cipriani)
Newsgroups: comp.lang.c
Subject: Experience with making multiple includes harmless
Keywords: cpp
Message-ID: <3251@tut.cis.ohio-state.edu>
Date: 16 Dec 87 13:43:41 GMT
Organization: Ohio State Computer & Info Science
Lines: 46

About 5 years ago at the beginning of a major porting effort
(thousands of files, and millions of lines of code) I had this
bright idea for making #includes harmless with the:

#ifndef SPLAT_H
#define SPLAT_H
	...
#endif /* SPLAT_H */

syntax.  The idea was to make each header file self sufficient.
If /usr/include/local/abc.h needed the information in
/usr/include/local/def.h, then abc.h would have the cpp statement

#include 

and all the c code would have to do is have the cpp statement:

#include 

and it would get everything it needed.  After using this for
about 5 years I now believe this was one of the worse ideas I
ever had.  The advantage is that it is great in development
(a relatively short time) (except for the slower compilation
times - yes you can notice it), but after that you have the
maintenance and enhancement stage (a relatively long time).
It is there where the idea fails miserably.

Instead of looking in the c file for all the includes, you
have to check all of the includes for includes (and recursively)
till you find what you want.  A partial remedy to this is to
generate a cross reference every night.
If the header files provided with your system are changed, then
you loose portability, and reusability.
Makefile dependency lists have files you might not care about,
and really do not affect your program.

Two related products that reused our code have ripped out
all of this and converted their c programs to explicitly
list all the header files it needs.

If I had to do it over again I wouldn't do this.  Maybe this isn't
convincing you, but I'm convinced it's a lousy idea.

-- 
	Larry Cipriani AT&T Network Systems at
	cbosgd!osu-cis!tut!lvc Ohio State University