Open main menu

Difference between revisions of "Code Formatting Conventions"

m
update formatting to match original website's style
(major formatting improvements)
m (update formatting to match original website's style)
Line 29: Line 29:
== 4. Whitespaces ==
== 4. Whitespaces ==


Conventional operators surrounded by a space character
'''Conventional operators surrounded by a space character'''


<pre>
<pre>
Line 35: Line 35:
</pre>
</pre>


C++ reserved words separated from opening parentheses by a white space
'''C++ reserved words separated from opening parentheses by a white space'''


<pre>
<pre>
Line 41: Line 41:
</pre>
</pre>


Commas followed by a white space
'''Commas followed by a white space'''


<pre>
<pre>
Line 48: Line 48:
</pre>
</pre>


Semicolons followed by a space character, if there is more on line
'''Semicolons followed by a space character, if there is more on line'''


<pre>
<pre>
Line 55: Line 55:
</pre>
</pre>


When declaring class inheritance and in a ? construct, colons should be surrounded by white space
'''When declaring class inheritance and in a ? construct, colons should be surrounded by white space'''


<pre>
<pre>
Line 62: Line 62:
</pre>
</pre>


Indentation level is not increased after namespace clause
'''Indentation level is not increased after namespace clause'''


<pre>
<pre>
Line 94: Line 94:
== 6. Naming ==
== 6. Naming ==


Constants
'''Constants'''


Basically, you have two choices:
Basically, you have two choices:
Line 108: Line 108:
</pre>
</pre>


Classes
'''Classes'''


Mixed case starting with upper case
Mixed case starting with upper case
Line 116: Line 116:
</pre>
</pre>


Class members
'''Class members'''


_ prefixed and in mixed case (Yo! no underscore separators), starting with lowercase.
_ prefixed and in mixed case (Yo! no underscore separators), starting with lowercase.
Line 124: Line 124:
</pre>
</pre>


Class methods
'''Class methods'''


mixed case, starting with lowercase.
mixed case, starting with lowercase.