Coding Standards

When you write programs , there are some important stylistic things that you should do to make your program clear and well-structured. Below is a list of these requirements:

  1. Check the return value of all system or library calls.
  2. There should be no more than one class per file.
  3. For non-template classes, the interface definition part of the class should be in a .h file and the implementation of the methods should be in a .C (or .cc) file.
  4. Always indent when statements are part of a control-flow statement such as "if" or "while". Choose a reasonable number of characters (such as 3 or 4) and make sure that you indent consistently.
  5. There should be constants other than, perhaps, zero or one, in your code. Any constant values should preferably be defined as using a "const" declaration or.
  6. Public data members are a really bad idea, in general. If you think that you need one, please come and talk with Me. They are not acceptable in your program without prior permission.
  7. Comments:
  8. You must use a "makefile" for your program. The default rule should build the whole program.
  9. You can use any class and method in the Standard Template Library (STL).