Skip to content

style guide

pkivolowitz edited this page Apr 3, 2017 · 9 revisions

RETURN VALUES SHOULD BE CHECKED

If it at all matters, do it!

Points of return / function exits

Should be kept to one. At the bottom.

Indenting

Tab stops set at 4. No Exceptions

Braces

Whoever adds to a source file must adhere to the bracing style already present in that file.

The preferred style is the brace-on-newline style:

if (bool)
{
}
else
{
}

while (bool)
{
}

Function declarations, commas and references / pointers

type NameOfFunction(type arg1, type * arg2, type & arg3)

Variable and function naming

Nothing extraordinary here.

Functions begin with caps. Variables don't.

Functions are camel back. No exceptions.

Variables should be words_split_with_underscores. However, if you're the first author of a file you can choose a different style. Second or later contributors must follow the variable naming style found in the file.

Constants ought to be ALL CAPS but not always. If they are shared between functions or methods, they should be ALL CAPS.

Use descriptive variable and function names. Typing is finite. Debugging is not.

Clone this wiki locally