Changes

Jump to: navigation, search

Team Excellence - oop344 20113 Code Standards

464 bytes added, 23:53, 18 October 2011
Class Standards
I have a proposal. How about doing it like this:
== If Statement ==
<syntaxhighlight lang="cpp">
if (condition)
{
stuff;
}
else if (condition)
{
stuff;
}
else
{
stuff;
}
</syntaxhighlight>
Notice the space between the 'if' and '(' and the lack of a space between the ')' and '{'. Also the 'else' starts a line under the '}'.
If the "stuff" is only one line the curly braces can be omitted.
'''Dzmitry:'''
if (condition){
stuff;
}else if (condition){
stuff;
}else{
stuff;
}
</syntaxhighlight>
That will save a few lines, also space between "stuff" and beginning of the line should be default Visual Studio Tab (Mine is 4 spaces). '''Jitender:'''Guys, we should agree one of the standard, I agree with Dzmitry proposal, it short and easy to follow
== For Loop ==
<syntaxhighlight lang="cpp">
for (i=0; condition; i++){
stuff;
}
== While Loop ==
<syntaxhighlight lang="cpp">
while (true){
stuff;
}
== Class Standards ==
'''Header File Standards:'''
<syntaxhighlight lang="cpp">
/**
**/
#ifndef _CLASS__INITIAL_CLASS_#define _CLASS__INITIAL_CLASS_ class CLASS { int _a; int _b;  public: function();}
class CLASS
#endif
</syntaxhighlight>
 
'''All Cpp File Standards:'''
<syntaxhighlight lang="cpp">
 
/* Function Starts here */
function name() {
 
/* Header goes here */
int key = 0; // Comment goes here
bool done = false;
 
/* Again Important Header goes here */
if(condition){
stuffs;
}
 
/* All Loops */
for(i=0; i<len; i++){
statements;
}
while(condition){
statements;
}
 
}
/* function ends here */
</syntaxhighlight>

Navigation menu