C/C++
From HCL
Contents
Coding
- Coding header files
- One-true-brace ident style
- Learn from examples and use coding approaches from third-party software
Commenting
- Place Doxygen comments in header files (before declarations of namespaces/classes/structs/typedefs/macros) and main source files (for documenting tools and tests)
- Use double forward slash for short comments in the code
C++
- Mixing C/C++
- Provide main API in C
- Use plain C unless you need flexible data structures or STL/Boost functionality
- Template C++ is preferrable from the point of view of runtime performance
- Mind the life cycle of objects: Default constructor Copy constructor, Destructor
- Force C++ linking
General
- Don't use non-standard functions, like itoa
- Handling program arguments (avoid
argp
since it is not supported on many platforms) - Dynamic loading of shared libraries