Open main menu

CDOT Wiki β

Changes

Skynet

1,073 bytes added, 11:43, 6 November 2012
Coding Rules
== Coding Rules ==
# Pointer/reference always beside datatype (int* a; or int& a;)
# Only one data definition per line (int a; NOT int a, b;)
# FOUR spaces instead of tab for indentation
#: Steps in visual studio
## Tools > Options
## Click: Text Editor, All Languages, Tabs
## Make sure
### Indenting: none needs to be selected
### Tab size: 4
### Indent size: 4
### Insert spaces selected
# Always have curly braces even when the code block is one line
# Commenting
## before every functions, write what the function does
## end of a long code block
## any code which may be confusing for others review
Sample Code
// function to display a string of characters based on field length
void Console::display(const char* str, int row, int col, int fieldLen){
console.setPos(row,col);
if (fieldLen){
int i=0;
for (;i<fieldLen && str[i];i++){
this->putChar(str[i]);
}
for (;i<fieldLen;i++){
this->putChar(' ');
}
}
else{
(*this)<<str;
}
}
 
== meetings ==
* latest will be on top