C++ style guide: Difference between revisions

No change in size ,  20 December 2023
m
Line 45: Line 45:
==== Control structures (if, while, ...) ====
==== Control structures (if, while, ...) ====


When indenting, indent the statement after control
When indenting, indent the statement after control structures (like {{codeline|if}}, {{codeline|while}}, etc.).
structures (like {{codeline|if}}, {{codeline|while}}, etc.). If there
 
is a compound statement, indent ''both'' the curly braces and the
If there is a compound statement, indent ''both'' the curly braces and the body of the statement (so that the body gets indented by ''two'' indents).
body of the statement (so that the body gets indented by ''two''
indents).


Example:
Example:
Line 63: Line 61:
</syntaxhighlight>
</syntaxhighlight>


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 ====
1,072

edits