IncludeDB

What are the basic rules for setting the right includes for a file?

Suppose I have a class ChromaticGadget that extends Gadget and uses OS
facilities. So I have chromaticGadget.hpp and chromaticGadget.cpp. What should
go in includeDB? In particular when do you have an entry for a .hpp vs.
.cpp file, i.e. should I have:

chromaticGadget.cpp     chromaticGadget.hpp
chromaticGadget.cpp     gadget.hpp
chromaticGadget.cpp     os.hpp

or:

chromaticGadget.cpp     chromaticGadget.hpp
 
chromaticGadget.hpp     gadget.hpp
chromaticGadget.hpp     os.hpp

Answer:

To reduce compile times, the fewer .hpp files on the left hand side,
the better. So the first example is preferred except ... since you
inherit from Gadget (which presumably is declared in gadget.hpp),
I expect you'll have to change the second line in that stanza to

chromaticGadget.hpp     gadget.hpp
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

Sign up or Log in to add a comment or watch this page.


The individuals who post here are part of the extended Sun Microsystems community and they might not be employed or in any way formally affiliated with Sun Microsystems. The opinions expressed here are their own, are not necessarily reviewed in advance by anyone but the individual authors, and neither Sun nor any other party necessarily agrees with them.

Copyright 1994-2009 Sun Microsystems, Inc.
Powered by Atlassian Confluence
Sun Guidelines on Public Discourse Privacy Policy Terms of Use Trademarks Site Map Employment Investor Relations Contact