Minor Physical Design Rules
-
Place a redundant (external) include guard around each preprocessor
include directive in every header file.
-
Use a consistent method (such as a d_ prefix) to highlight
class data members.
-
Use a consistent method (such as uppercase first letter) to
distinguish type names.
-
Use a consistent method (such as all uppercase with underscore)
to identify immutable values such as enumerators, const data,
and preprocessor constants.
-
The root names of the .c file and the .h file that comprise a component
should match exactly.
-
Never pass a user-defined type (i.e., class, struct, or union)
to a function by value.
-
Never attempt to delete an object passed by reference.
-
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.
-
Avoid depending on the order in which data members are defined
in an object during initialization.
-
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.