Xref: utzoo comp.software-eng:1152 comp.lang.c++:2671 Path: utzoo!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!cwjcc!tut.cis.ohio-state.edu!rutgers!att!pegasus!psrc From: psrc@pegasus.ATT.COM (Paul S. R. Chisholm) Newsgroups: comp.software-eng,comp.lang.c++ Subject: Re: Recursive #includes Summary: see comp.lang.c++ Keywords: recursive includes, modularity Message-ID: <2630@pegasus.ATT.COM> Date: 27 Feb 89 03:28:13 GMT References: <570@marob.MASA.COM> Followup-To: comp.software-eng Organization: AT&T Bell Laboratories Lines: 30 In article <570@marob.MASA.COM>, samperi@marob.MASA.COM (Dominick Samperi) writes: > : > > #ifndef H_FOO > #define H_FOO >...stuff... > #endif This issue was beaten to death a few weeks ago in the comp.lang.c++ news group. The obvious proposal is to not #include a file that's already been #included, even if you see a second (or third, or forty- second) #include for it. This would also be more efficient that what you suggest above, since the file doesn't even need to be opened again, let alone read. Unfortunately, it can break existing C code. We had such a cpp (back in the bad old days of Net 1000, a large development project). People tended to #include the whole world, just in case; but it did speed up compilation quite a bit (we had lots of big header files). The C++ header files I've seen do things like #ifndef STDIO_H, as you suggest above. It may not the best solution, but it works. For more information, look at old comp.lang.c++ articles (no, I don't know of any place that archives them). >Dominick Samperi -- ESCC, samperi@marob.masa.com, uunet!hombre!samperi Paul S. R. Chisholm, AT&T Bell Laboratories, att!pegasus!psrc psrc@pegasus.att.com, AT&T Mail !psrchisholm I'm not speaking for the company, I'm just speaking my mind.