Skip navigation.

C++ coding standards

This document contains a suggestion of C++ coding standards. This is a combination of other standards and is roughly what I follow when I code.

Obviously an incomplete document, but I'll add stuff soon :)

Naming files

All header files should follow the example:

ThisIsMyFile.hpp

Corresponding source files should follow the example:

ThisIsMyFile.cpp

The .cpp and .hpp files can be in the same path if you like (recommended for small projects), however the build system should be separate (no object files should appear in the source code during compilation). I personally use CMake for building projects.

Comments

Doxygen is always a good idea!

Naming functions

Naming variables

Defining macros

Defining a macro should look like:

#define MYMACRO my_macro_code