Menu

Code_Conventions

Bohdan Stelmakh benblan

[Project Guidelines and Rules]

Default Code Convention

Freesynd uses the Google C++ Style Guide for its coding style. But there are rules that are specific to this project.
We also use the recommandations based on this site : https://github.com/cpp-best-practices/cppbestpractices by Jason Turner

Project Specific rules

Naming

Variable Names

  • Variables names are in lowerCamelCase
  • Class data members names are in lowerCamelCase and end with a trailing underscore.
  • Don't use prefix in variable names

Function Names

  • Function names are in lowerCamelCase

Code Formating

Indention with 4 spaces, no tabs.

function lowerCamelCase(param) {
}

or

function lowerCamelCase(param)
{
}
function lowerCamelCase(a lot of parameters    <= more then 80 columns
&nbsp;&nbsp;&nbsp;&nbsp;yes alot of them) <= may be without indention
{
}
if (check)
&nbsp;&nbsp;&nbsp;&nbsp;exp = value;

if (really long check   <= more then 80 columns
&nbsp;&nbsp;&nbsp;&nbsp;yes very long check)
{
&nbsp;&nbsp;&nbsp;&nbsp;exp = value; <= single line
}

if (check) {
&nbsp;&nbsp;&nbsp;&nbsp;exp = value;
&nbsp;&nbsp;&nbsp;&nbsp;exp = value;
&nbsp;&nbsp;&nbsp;&nbsp;...
}

if (another long check <= more then 80 columns
&nbsp;&nbsp;&nbsp;&nbsp;yes it is long)
{
&nbsp;&nbsp;&nbsp;&nbsp;exp = value;
&nbsp;&nbsp;&nbsp;&nbsp;exp = value;
&nbsp;&nbsp;&nbsp;&nbsp;...
}

switch (var) {
    case num0:
        break;
    case num1:
        break;
    default:
}

Related

Wiki: Project Guidelines and Rules