1
edit
Changes
→Coding Style Rules: Final Version
==<big>Coding Style Rules</big>==
Example:<br /><div><b style="color: #008800; line-height: 0.5em;"> /*<br /> Title<br /> Title.h<br /> By: Full Name<br /> Date Last Modified: 9:59 AM April-15-10<br /> Description of what is in the file<br /> */<br /></b></div><br /> Variable names should be meaningful so additional comments are not necessary to explain what the variable does. Example:<div><b style="color: #000000; line-height: 0.5em;"> int nNum; <span style="color: #008800;">//Bad</span><br /> int nNumOfTypes <span style="color: #008800;">//Good</span><br /></b></div><br />
A lower case prefix should be fitted to the variable name to help describe it at a glance:
All variable declaration const and #define Variable names should be done on it's own linein All Caps
Pointers should be declared in C++ style:
Example:<br />
<div>
<b style="color: #000000; line-height: 0.5em;">
int* x;<br />
NOT<br />
int * x; OR int *x;<br />
</b>
</div>
<br />
Class names should be all lower case except for the first letter, which should be upper case.
Function names should have meaningful names (They do not require prefix).
Function names Should be all lower case except for the First letter of each Word.
Example:<br /><div><b style="color: #000000; line-height: 0.5em;"> GetChar();<br /> NOT<br /> getChar(); OR Getchar();<br /></b></div><br /> Each function should have only one point of entry and one point of exit.! I.E. There should be only 1 return statement in each function.
Each function should have a header describing what it does.
Use Inline comments to describe hard to read code. All inline code should be set to the same indention as the code it is describing.
Example:<br />
<div>
<b style="color: #000000; line-height: 0.5em;">
//Comment<br />
GetChar();<br />
NOT<br />
//Comment<br />
GetChar()<br />
</b>
</div>
<br />
Opening braces should be on the same line as the defining function/if/else if/etc statement.
Example:<br />
<div>
<b style="color: #000000; line-height: 0.5em;">
void FunctionOne(int){<br />
if (x > y){<br />
NOT<br />
void FunctionOne(int)<br />
{<br />
if (x > y)<br />
{<br />
</b>
</div>
<b>
There should be NO use of the tab character!!!
Each indent should be 3 blank spaces! I will write a wiki on how to set this up in VS 2008, VS 2010,And Notepad++
</b>
<br /> <br />