Open main menu

Difference between revisions of "Code Formatting Conventions"

→‎Whitespaces: Added vertical alignment
(Bulk replace: syntax="C++" -> 'source="cpp" so that we don't have to use a custom syntax highlighting extension)
(→‎Whitespaces: Added vertical alignment)
Line 145: Line 145:
int i = 0;
int i = 0;
int &ref = i;
int &ref = i;
</source>
'''Vertical alignment'''
When it adds to readability, a vertical alignment by means of extra tabs or spaces is allowed. However, it is not advised to have the opening and closing brackets/braces to occupy a single line.
<source lang="cpp">
int foo    = 2;
int morefoo = 3;
Common::Rect *r = Common::Rect(x,
                              y,
                              x + w,
                              y + h);
</source>
</source>