Indentation is done with tabs, not spaces. Tabs are 4 spaces wide.
Braces follow Allman-style with brace-less single-line statements being allowed and encouraged when it does not make things less readable:
There are no spaces between parenthesis and function names, if, for, etc.
Names can be either in UpperCamelCase
or snake_case
, but it should be consistent across the whole project.
lowerCamelCase
is used never except when using anything else would make the code awkward, for example on Android.
Correct:
int example()
{
if(something)
{
int r = another_function(42);
return r;
}
else
return 0;
}
Wrong:
int example () {
if (something) {
int r = anotherFunction (42);
return r;
} else {
return 0;
}
}