1,852
edits
Line 7: | Line 7: | ||
== Formatting == | == Formatting == | ||
=== Line Length === | |||
Maximal length of source lines is 79 characters. | |||
=== Indentation === | === Indentation === | ||
Use only spaces | * Use only spaces. | ||
* Tabs are prohibited. | |||
* Indent with 2 spaces at a time. | |||
==== Control structures (if, while, ...) ==== | |||
When indenting, indent the statement after control | When indenting, indent the statement after control | ||
Line 19: | Line 24: | ||
is a compound statement, indent ''both'' the curly braces and the | is a compound statement, indent ''both'' the curly braces and the | ||
body of the statement (so that the body gets indented by ''two'' | body of the statement (so that the body gets indented by ''two'' | ||
indents). | indents). | ||
Example: | |||
<syntaxhighlight lang="cpp"> | <syntaxhighlight lang="cpp"> | ||
Line 34: | Line 40: | ||
If you have nested {{codeline|if}} statements, use extra braces for extra | If you have nested {{codeline|if}} statements, use extra braces for extra | ||
clarification. | clarification. | ||
==== Split long expressions ==== | |||
Split long expressions in such a way that a continuation line starts | Split long expressions in such a way that a continuation line starts | ||
Line 66: | Line 74: | ||
unsigned int& reference_variable; | unsigned int& reference_variable; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=== Function headers === | === Function headers === |