Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!pasteur!helios.ee.lbl.gov!ace.ee.lbl.gov!jef From: jef@ace.ee.lbl.gov (Jef Poskanzer) Newsgroups: comp.software-eng Subject: Re: Recursive #includes Message-ID: <1991@helios.ee.lbl.gov> Date: 28 Feb 89 01:07:59 GMT References: <18136@glacier.STANFORD.EDU> Sender: usenet@helios.ee.lbl.gov Reply-To: Jef Poskanzer Organization: Paratheo-Anametamystikhood Of Eris Esoteric, Ada Lovelace Cabal Lines: 37 In the referenced message, jbn@glacier.UUCP (John B. Nagle) wrote: }>> #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. Read, yes; parsed, no. You would be surprised at how few cycles are used in reading an include file and just handling the #ifs. On a Sun 3/260: stdio.h's user system elapsed 1 0.6 0.4 5 delta 6.3 1.5 7 501 6.9 1.9 12 delta 6.5 1.3 7 1001 13.4 3.2 19 delta 6.7 1.0 10 1501 20.1 4.2 29 Looks to me like handling a stdio-sized include file for a second time costs about 0.013 user, 0.003 system, and 0.015 elapsed. I think I can live with that, especially considering the minutes to hours of my time that the current idiotic #include scheme wastes each time I need to figure out what files to include. I argued this issue a few years ago when I was working at UniSoft. I provided data similar to the above, and assumed that the benefits of including only the files you explicitly reference would be obvious to all. Sadly, I was ignored. --- Jef Jef Poskanzer jef@helios.ee.lbl.gov ...well!pokey In Stereo (where available)