Tilted Online
Code Guidelines
Coding guidelines to keep the code readable and understandable.


We are using C++17, any C++17 feature supported by vs2019 is allowed.
Please try to use templates responsibly, we don't want compilation times to explode and to deal with bloated binaries.
Try to follow SRP as much as possible, a huge class containing tons of functionalities is not better than many small components; it's easier to re-use and extend them.



The first word is lowercase, any other words must start with an uppercase: camelCase.
Function arguments must be prefixed with an a for 'argument' : aFunctionArgument.
Const variables must be prefixed with a c for 'const' : const int cSomeInt;
Pointers must be prefixed with a p for 'pointer' : int* pSomePointer.
The rules above must be used together. For example: void SomeFunc(const int* acpSomeArgument).
Static variables must be prefixed with s_ : static int s_someInt;.
Global variables must be prefixed with g_ : extern int g_someGlobalInt;.


Class names must start with an upper case: class SomeClass.
Class attributes must be prefixed with m_ and must use the same rules as variables: int* m_pSomeMemberPointer;.


All functions must start with an upper case: void SomeFunc();.


Names must be self explanatory. For example, size_t a; is not acceptable, but size_t incomingPacketCount; is good.
auto is allowed when dealing with long names, but it isn't acceptable for primitive types as we don't want the compiler to give us a signed int when we are using it as an unsigned int.
Don't use Java style blocks, a { needs to be on a new line.
Don't use exceptions and don't use STL code that can throw - use the nothrow version if available, or the unsafe version if not. Use the Outcome class to return the value or an error.
Last modified 7mo ago