Difference between revisions of "Code Standards"
From Open Babel
(New page: Several important goals have been adopted for version 3.0: # Headers must use forward declarations. For example, if you use OBAtom, you should #include <openbabel/atom.h> not mol.h. # De...) |
(No difference)
|
Latest revision as of 08:35, 25 August 2008
Several important goals have been adopted for version 3.0:
- Headers must use forward declarations. For example, if you use OBAtom, you should #include <openbabel/atom.h> not mol.h.
- Deprecated code, headers, classes will be removed. Gone.
- Use of "const" declarations
- Use of "unsigned" where appropriate
- Using hidden data pointers where appropriate to allow future expansion while preserving API and ABI (i.e., v3.1 will be binary compatible)
- Moving functions to protected and private which should not be public.
- Moving classes from public headers to implementation which should not be public (see parsmart.h for some horrible examples)
- 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.
- The KDE Project Library Code Policy will be adopted in some form for Open Babel
- The Google C++ Style Guide has other useful suggestions
- The C++ FAQ
- C++ Reference
- C++ Library Reference