Here are some good techniques by Herb Sutter:
http://www.gotw.ca/publications/mill04.htmResumed:
o
Avoid gratuitous #includes. Use forward declarations whenever a definition isn't required. (For forward declaring iostreams, use the header
<iosfwd>).
o
Avoid unnecessary membership. Use the Pimpl Idiom to fully hide a class' private implementation details. This is a design choice, and a very important one. An example where you can see it working is
OMGUI.
o
Avoid unnecessary inheritance. Prefer composition/membership over inheritance wherever possible.
A technique to
decrease linking time (specially when using an external library) is
linking directly to the DSO (.dll).
This technique is frequently used in linux, but not so well known in win32. Latests versions of MinGW support it.
To see a real world example in C::B, look at the
Ogre3d C::B project samples.
If using
GCC4, make use of the
Visibility flag.
It improves load times of the DSO, let's the optimiser produce better code, reduces the size by removing unnecessary symbols, producing much lower chance of symbol collision and faster linking time.