Minor Physical Design Rules

  1. Place a redundant (external) include guard around each preprocessor include directive in every header file.

  2. Use a consistent method (such as a d_ prefix) to highlight class data members.

  3. Use a consistent method (such as uppercase first letter) to distinguish type names.

  4. Use a consistent method (such as all uppercase with underscore) to identify immutable values such as enumerators, const data, and preprocessor constants.

  5. The root names of the .c file and the .h file that comprise a component should match exactly.

  6. Never pass a user-defined type (i.e., class, struct, or union) to a function by value.

  7. Never attempt to delete an object passed by reference.

  8. In every class that declares or is declared from a class that declares a virtual function, explicitly declare the destructor as the first virtual function in the class and define it out of line.

  9. Avoid depending on the order in which data members are defined in an object during initialization.

  10. When implementing memory management for a general, parameterized container template, be careful not to use the assignment operator of the contained type when the target of the assignment is uninitialized memory.