Code Standards

From Open Babel
Jump to: navigation, search

Several important goals have been adopted for version 3.0:

  1. Headers must use forward declarations. For example, if you use OBAtom, you should #include <openbabel/atom.h> not mol.h.
  2. Deprecated code, headers, classes will be removed. Gone.
  3. Use of "const" declarations
  4. Use of "unsigned" where appropriate
  5. Using hidden data pointers where appropriate to allow future expansion while preserving API and ABI (i.e., v3.1 will be binary compatible)
  6. Moving functions to protected and private which should not be public.
  7. Moving classes from public headers to implementation which should not be public (see parsmart.h for some horrible examples)
  8. Use the normal C++ standard file/class organization, that is, the class OBAtom should be defined in atom.cpp and atom.h. One class ONLY per .h/.cpp file pair.

External Sources

Several excellent sources exist for high-quality C++ code.