Coding Style: Difference between revisions

Jump to navigation Jump to search
(Migrating Coding Style from google code's wiki)
 
m (Some minor adjustments to make it easier to read)
Line 4: Line 4:


<pre>astyle -A1TfpHUxdk1W1wYm0M2j filename.cpp</pre>
<pre>astyle -A1TfpHUxdk1W1wYm0M2j filename.cpp</pre>


== General Rules ==
== General Rules ==
Line 14: Line 15:
*Try to eliminate all warnings.
*Try to eliminate all warnings.
*Define global variables at the top of the file/namespace they belong to.
*Define global variables at the top of the file/namespace they belong to.


== Naming Rules ==
== Naming Rules ==
Line 32: Line 34:
**statics
**statics
***"s_"
***"s_"


== Class Names ==
== Class Names ==
Line 43: Line 46:
*Follow the indentation/whitespace style shown in the example.
*Follow the indentation/whitespace style shown in the example.


UsefulClass.h
 
=== UsefulClass.h ===


<pre>#pragma once
<pre>#pragma once
Line 83: Line 87:
}
}
// Every file should end in a newline</pre>
// Every file should end in a newline</pre>


== Indentation/Whitespace Style ==
== Indentation/Whitespace Style ==
Line 176: Line 181:


}</pre>
}</pre>


== DON'T DO ==
== DON'T DO ==