(and other stuff)
- You are required to use
cmake
- File extensions: .h for header files, .cpp for source files, .hpp for inline header-only cpp code
- Use only 4 spaces for indentation (not tabs, setup your code editor properly)
- Newline should be presented in the end of each file
- Files should be saved only in utf-8 encoding
- Strings should not have any trailing spaces
- All files should have lowercased name
- Use lowercase for variables, structs, method/function names, namespaces
- If name of any item from list above consists of 2 or more words, use
_
to distinguish them. (snake_case) - Structs and other type representations should have
_t
postfix after actual name - Classes should be PascalCase.
- Each namespace definition should have
{
on the next line, except occasions of single-lined/inline methods/functions - Each function/method definition should have
{
on the next line - Each for/if/while/etc contruction should have
{
on the same line - Each for/if/while/etc contruction should have
(
with space after (if (a == 15
) - Each for/if/while/etc contruction should have
{}
except its single-lined (on same line with if/... used only withreturn
or exception throws) - Each
catch
aftertry
contruction should be on the next line after closing try}
brace
- Each opreator should be surrounded by 1 space from both sides
int a = 5;
, except small inline math equations - If its possible, you should try to make operators lined up with ones defined on nearby lines:
int somevar = 15;
float asd = 124.0f;
bool hello = false;
- All includes should have
<>
brackets, except ones that are for local files (near current file).
- Each header file should have include-guard with
#ifndef librg_filename_h
and closing#endif // librg_filename_h
- Each included header from library should be located in file it's supposed to be used
- If library uses namespaces, you should not use
using namespace somelib;
unless being isolated and encouraged - Keyword
auto
should be used in most of the cases, in local functions/methods - Long repeating types should be defined via
using
ortypedef
(first one is much more preferable) - All private (or intended to be private) members should have single underscore symbol
_
- All public methods and variables should have multiline jsdoc-like comments
- Methods should have inline comments in places, where they can give a good description for what is happening or can improve readability
- You are required to put comment with copyright notice in the beginning of the each file