Path: utzoo!attcan!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!uwm.edu!gem.mps.ohio-state.edu!ginosko!uunet!modcomp!joe From: joe@modcomp.UUCP Newsgroups: comp.lang.c Subject: Re: A solution to the multiple inclusio Message-ID: <90700006@modcomp> Date: 25 Oct 89 03:34:00 GMT References: <14240@well.UUCP> Lines: 22 Nf-ID: #R:well.UUCP:14240:modcomp:90700006:000:1000 Nf-From: modcomp.UUCP!joe Oct 24 23:34:00 1989 Lawrence Crowl writes: > Each include file defines a symbol (preferably related to its name). For > example, in foo.h: > #define foo_h > Each file that includes foo.h, protects the inclusion with a #ifndef: > #ifndef foo_h > #include "foo.h" > #endif foo_h > I have used this solution as a matter of course since shortly after I learned > to program in C. It is an obvious solution, and leads me to wonder why it is > not common practice. Any explainations? Well, for one thing, it's clumsy to enter. For another, it's clumsy to read. Finally, it places this dirt at point-of-use, rather than point-of-definition, where it really belongs (reason: thingys defined once; used many times). For many of us, these are sufficient reasons to put this mechanism entirely in the include file, in spite of the obvious (machine) inefficiencies involved. -- joe korty "for every vengence there is an equal and uunet!modcomp!joe opposite revengence." (from Cartoon Laws)