Article View: comp.lang.c++.moderated
Article #70Re: Tool for removing surplus #includes
From: Tony Houghton
Date: Wed, 28 Feb 1996 22:28
Date: Wed, 28 Feb 1996 22:28
56 lines
2617 bytes
2617 bytes
In article <4gum81$hlk@netlab.cs.rpi.edu>
nababs@qualcomm.com (Nasser Abbasi) wrote:
> In article <4gj0p3$lp0@solutions.solon.com>, tonyh@tcp.co.uk says...
> >
> >Does anyone know of a PD tool available with portable(ish) source for
> >removing surplus #include directives? For example:
> >
> >/* "file2.h" */
> >#include "file1.h"
> >
> >-------------------
> >
> >/* "file3.h" */
> >#include "file1.h"
> >#include "file2.h"
> >
> >-------------------
> >
> >#include "file1.h" could be removed from "file3.h". This sort of thing
> >saves a lot of compiler time without having the chore of typing:
> >
> >#ifndef __file1_h
> >#include "file1.h"
> >#endif
> >
>
> So, you mean that in the future if you decide that file2.h do not
> need to include file1.h any more, you have to somehow remember
> to go back to file3.h and add a line to include file1.h, since may
> be file3.h needs file1.h but file2.h do not need file1.h
>
> Having to deal with these sort of things will most likley be not worth
> the effort. Also remember that all this work with including .h files
> is done by the pre-processor, not by the compiler itself.
I think I'm inclined to agree with you now, but I don't understand your
point about the work being done by the preprocessor, not the compiler.
I'll stick to surrounding each include with an #ifndef.
> I think you are trying to save few nanoseconds here from the
> pre-processor time
It takes more than nanoseconds.
--
Tony Houghton tonyh@tcp.co.uk
Using an Acorn RiscPC 700 http://www.tcp.co.uk/~tonyh/
No Intel inside, no Microsoftware. A computer, not a cartel.
----------------------------------------------------------------
The Internet is a most invaluable resource for Internet software
[ Articles to moderate: mailto:c++-submit@netlab.cs.rpi.edu ]
[ Read the C++ FAQ: http://www.connobj.com/cpp/cppfaq.htm ]
[ Moderation policy: http://www.connobj.com/cpp/guide.htm ]
[ Comments? mailto:c++-request@netlab.cs.rpi.edu ]
Technical Details
Message-ID:
<4h2kto$c9k@netlab.cs.rpi.edu>Path:
arc1-ca.pugleaf.net!library.erc.clarkson.edu!rpi!not-for-mailReferences:
<4gj0p3$lp0@solutions.solon.com> <4gum81$hlk@netlab.cs.rpi.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!library.erc.clarkson.edu!rpi!not-for-mail From: Tony Houghton <tonyh@tcp.co.uk> Newsgroups: comp.lang.c++.moderated,comp.lang.c Subject: Re: Tool for removing surplus #includes Date: 28 Feb 1996 22:28:08 -0000 Organization: UWL Sender: cppmods@netlab.cs.rpi.edu Approved: vandevod@cs.rpi.edu Message-ID: <4h2kto$c9k@netlab.cs.rpi.edu> References: <4gj0p3$lp0@solutions.solon.com> <4gum81$hlk@netlab.cs.rpi.edu> NNTP-Posting-Host: netlab.cs.rpi.edu X-Original-Date: Wed, 28 Feb 1996 20:53:20 +0000