Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!usc!ginosko!uakari.primate.wisc.edu!xanth!mcnc!ecsvax.uncecs.edu!utoddl From: utoddl@uncecs.edu (Todd M. Lewis) Newsgroups: comp.lang.c Subject: Re: A solution to the multiple inclusion problem Summary: could this be a compiler switch Keywords: #include c c++ Message-ID: <1989Oct25.121308.1925@uncecs.edu> Date: 25 Oct 89 12:13:08 GMT References: <14240@well.UUCP> <15316@bloom-beacon.MIT.EDU> <1989Oct24.153611.12168@lotus.com> Distribution: comp Organization: UNC Educational Computing Service Lines: 25 In article <1989Oct24.153611.12168@lotus.com>, mgordon@lotus.com (PCSD Mac) writes: > > How about a new preprocessor directive that means "include this file only > if it hasn't already been included", say "#require"? The "preprocessor" > would simply keep a table of files that have already been included and use > it to avoid including the same #required file more than once. There will > always be files you really do want to #include multiple times, so you can't > change the meaning of #include. Could this not be done with a compiler switch? You could switch it off if you really did have to include a file multiple times, but this doesn't happen too often in Real Life (not mine anyway). Actually, the compiler I use lets me dump its symbol table to a file. Later, I compile with a switch which says "use this here file to preload your symbol table", and I don't have to process all those include files every time. Works like a charm. If I then #include a file that is one of the pre-cooked ones in dump file, the compiler doesn't include it again. This cuts compile times way down. _____ | Todd M. Lewis Disclaimer: If you want my employer's ||\/| utoddl@ecsvax.uncecs.edu ideas, you'll have to || || utoddl@ecsvax.bitnet _buy_ them. | || |___ ("Prgrms wtht cmmnts r lk sntncs wtht vwls." --TML)