next up previous
Next: Patterns Up: PRIS Programmer's Handbook Previous: Source Control

Class Definition Guidelines

Classes

Be Careful with Compiler Created Functions
Be careful about what the compiler will automatically create if you don't. If you don't need/want a compiler created function, declare it private and don't implement it.
Alway Put Inlines at Bottom
Put the inline function definitions down at the end of the .H file. Declare all classes and free functions at the top, then define all inlines.

Functions

Be Careful about Inlines
Use only when necessary. Inlined functions can make the executable large, slowing down the overall speed of the program potentially more than the benefits of the overall inlining.
Use Const
Use it as much as possible.
Avoid Pointers
Use references as much as possible. It's much harder to corrupt memory with a reference. No need to worry about NULL references. Gives the compiler more info.
Never Delete NULL
Never check if a pointer is NULL before deleting. It is not an error to delete NULL.



Comments: Brian Edward Smits
Wed Apr 23 17:04:33 MDT 1997