Path: utzoo!attcan!uunet!husc6!mailrus!uflorida!haven!ncifcrf!nlm-mcs!vax2.nlm.nih.gov!mjr From: mjr@vax2.nlm.nih.gov.nlm.nih.gov (Marcus J. Ranum) Newsgroups: comp.lang.c++ Subject: Re: Managing C++ Libraries: Dependencies and Headers Message-ID: <8370@nlm-mcs.arpa> Date: 7 Nov 88 01:29:00 GMT References: <5078@thorin.cs.unc.edu> <7573@nsc.nsc.com> Sender: nobody@nlm-mcs.arpa Reply-To: mjr@vax2.nlm.nih.gov (Marcus J. Ranum) Organization: Institute For Felinographical Studies Lines: 35 In article <7573@nsc.nsc.com> rfg@nsc.nsc.com.UUCP (Ron Guilmette) writes: >OK. So how about a slightly more intelligent pre-processor which would >(a) keep a list of all files included so far, and (b) avoid including >files which have already been included once (even if they are called for >again via further #include's)? This would have the same effect as the >encapsulation of header files within #ifdef's (which many people are using >now). How about a pre-processor designed for C++ from the start ? Not that I propose to go off tomorrow and write one, but if we assume that using consts and inlines MOST of the functionality of '#define' is provided (except for conditional compilation). If we assume that the job of the preprocessor is to handle file inclusion and conditional compilation, I'd suggest that it could be replaced with something that acted more like a linker than a pre-processor. Suppose we had some "pre-processor" that was (better) able to cope with conditional directives (a must), and otherwise maintained some small database of what object was defined where, and what other objects it depended on. At that point, the "pre-processor" would be expected to only include exactly what was needed. Another advantage of a system like that is that it would allow pretty quick checks to see if something already existed in the programmer's name space. I'd expect a big compilation speed gain could be had, as well, if the objects to be included were arranged for faster access through some form of index, or even stored in a 'semi-compiled' state. If such a system were designed right, it would possibly support the eventual thrust towards being able to compile only those functions in a source module that were modified, and so on. I realize I am talking pretty much through my hat, and that there would be a lot of problems with such an approach (managing multiple include trees, nested includes, etc, etc.). I suspect, however, that some kind of similar approach will be needed sooner or later. "Strange women lying in ponds, distributing swords is no basis for a system of government. Supreme executive power derives from a mandate from the masses, not from some farsical aquatic ceremony."