Coding Style: Difference between revisions

Added syntax highlighting
(Added Development category)
(Added syntax highlighting)
Line 49: Line 49:
=== UsefulClass.h ===
=== UsefulClass.h ===


<pre>#pragma once
<syntaxhighlight lang="cpp">#pragma once


class UsefulClass : public SomeParent, public AnotherParent
class UsefulClass : public SomeParent, public AnotherParent
Line 86: Line 86:
         return m_x;
         return m_x;
}
}
// Every file should end in a newline</pre>
// Every file should end in a newline</syntaxhighlight>




Line 93: Line 93:
Follow the indentation/whitespace style shown below.
Follow the indentation/whitespace style shown below.


<pre>namespace Example
<syntaxhighlight lang="cpp">namespace Example
{
{
// Namespace contents are not indented
// Namespace contents are not indented
Line 180: Line 180:
}
}


}</pre>
}</syntaxhighlight>




Line 187: Line 187:
Do not do any of this.
Do not do any of this.


<pre>// Try to avoid macros, use a constant variable instead
<syntaxhighlight lang="cpp">// Try to avoid macros, use a constant variable instead
#define FOO_BAR 5
#define FOO_BAR 5


Line 241: Line 241:
          
          
         /* Don't use multiline comments */
         /* Don't use multiline comments */
}</pre>
}</syntaxhighlight>


[[Category:Development]]
[[Category:Development]]