Practical, Pragmatic, C++
RSS icon Email icon Home icon
  • Header Files

    Posted on March 21st, 2009 wozname 1 comment

    The physical design of a project is a vast topic, I think it will be useful to suggest some simple practices that will help point you in the right direction when you are just starting a project. They can also be applied to a large project but more care is needed.

    The first things you can do:

    1. Make all headers standalone
    2. Keep your classes in seperateĀ .hpp and .cpp pairs, aim for one class per file.
    3. Use precompiled headers as an optimisation technique and nothing more.
    4. Don’tĀ put using namespace in any of your header files, you’ll pollute the namespace.
    5. Be careful of templates and where they are defined.

    Read the rest of this entry »