Open main menu

CDOT Wiki β

Changes

OOP344 - Team Nothing - 20102

2,056 bytes added, 19:06, 30 May 2010
4.0 Conventions and Styles
=4.0 Conventions and Styles=
==4.1 Function Naming Convention==
Function names are all lowercase and each word are separated by a _
 
<pre>
int function_name()
{
code;
}
</pre>
 
==4.2 Variable Convention==
===4.2.1 Naming Convention===
Similar to the 4.1 Function Naming Convention
 
For Compound:
<pre>
int some_var;
</pre>
 
OR
 
For Single:
<pre>
int var;
</pre>
===4.2.2 Creating===
Each variable should be on it's own line
 
<pre>
int var1;
int var2;
</pre>
 
==4.3 Indent Level==
The indent level in any case will consist of three spaces. There will be no tab use.
 
<pre>
int someFunction
{
 
code;
more code;
 
}
</pre>
 
==4.4 File Heading==
Each file with the extension of *.cpp, *.c, and *.h must include a comment heading stating the file name, author (and username), date created, last modified date, and description of what the file does. The description should be clear and concise. This must be enclosed using /* and */.
 
<pre>
/*
* File Name: example.cpp
* Author: Name (senecaid)
* Create Date: 23-May-10
* Last Modified Date: 11-Nov-10
* Description: blah blah blah
*/
</pre>
 
==4.5 Function Comments==
Each function should include a comment above the function similar to the file heading (4.4 File Heading), except only including the function name, what each variable does in the function, and a description of what the function does
<pre>
/*
* Function Name: function_name
* Description: Blah blah blah.
* Variable: variable1 - this does this to this function
* variable2 - this is 2
*/
int function_name()
{
 
code;
 
}
</pre>
 
==4.6 Curly Braces==
Use of { } in a code block, such as in an if statement, a for loop, should start on a new line, with the { } lined up with the first character of the line above it. If the code block only has one coded line for the result, please use the curly brackets anyways for readability’s sake.
<pre>
void function()
{
if(some-condition)
{
code;
}
}
 
if(some-condition)
{
code;
}
else
{
code;
}
</pre>
 
==4.7 Conditional Compilation==
 
<pre>
#ifndef _tn_headerfilename_h
</pre>
1
edit