-
Notifications
You must be signed in to change notification settings - Fork 186
Contributing
Ilia Bozhinov edited this page Apr 6, 2020
·
7 revisions
File names are all lowercase, with -
as word separator. Headers end in .hpp
. So, a header could be called this-is-example-header.hpp
.
In general, line width is limited to 80 characters, although a few characters more are allowed if it improves readability.
Exceptions can be made for boilerplate code (for example, see the end of render-manager.cpp
)
- Indentation is spaces, not tabs. Usually 4 spaces for functions, classes and control flow structures.
- When function arguments are broken, the arguments on each subsequent line are indented with 8 spaces.
- No additional indentation inside
namespace
. -
public
,private
, andprotected
, are indented just 2 spaces. So it looks like this:
class ABC
{
public:
ABC();
private:
void foo();
};
Class, method and variable names are all in snake_case. Class names should end in _t
.
Braces are necessary in all cases except for single-line ifs (Both condition and statement are single-line).
Curly braces should usually begin on a new line. Exceptions are a series of single-line if/else if/else
chains.
Spaces are used:
- Before and after operators
- Between
if
,for
,while
and the opening brace.