Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!decwrl!labrea!glacier!jbn From: jbn@glacier.STANFORD.EDU (John B. Nagle) Newsgroups: comp.software-eng Subject: Re: Recursive #includes Keywords: recursive includes, modularity Message-ID: <18136@glacier.STANFORD.EDU> Date: 27 Feb 89 18:52:18 GMT References: <570@marob.MASA.COM> <2630@pegasus.ATT.COM> Reply-To: jbn@glacier.UUCP (John B. Nagle) Organization: Stanford University Lines: 24 In article <2630@pegasus.ATT.COM> psrc@pegasus.ATT.COM (Paul S. R. Chisholm) writes: >In article <570@marob.MASA.COM>, samperi@marob.MASA.COM (Dominick Samperi) writes: >> : >> >> #ifndef H_FOO >> #define H_FOO >>...stuff... >> #endif It does add to your compile times, since the entire file you're not including has to be read and parsed. I support the idea that #include should not include files "already included". The exact semantics of this need to be carefully defined, so that it's well-defined whether #include and "#include "stdio.h" are considered to be identical, and the implications of pathnames need to be thought out. But it's a good idea. Given this, it would be normal for all .h files to contain includes for any .h files they require, and creators of .c files could totally ignore the internal dependency problems of the library. For those rare situations when you really want to insert a file more than once, a new command, perhaps "#insert" should be defined.