These are the guidelines that will be followed for coding in the project. Anyone who wants to submit patches must follow these guidelines or they would be rejected.
declare methods and variable scope in this order: public, protected, private
for a given scope, always declare variable first, then methods.
Only inline methods or methods for a template class can be implemented in the header file
as much as you can, dont use public member, but function that set/get these member (especialy for pointers)
indent unit is 4 space
dont use tabs cause it 'sux' in vi (there is an emacs setting to convert tabs in spaces)
if we can, restrict to 80 characters per line (because of console limitation)
english language (except for cool quotes in the code ;) )
function header comments are starting with /**, each line has a leading * and the last line is */
/**
* this function is doing nothing :)
*/
void dummyFunction()
{
}
Comments in the code should be done with the // operator.
one variable declaration per line:
int l_test; int l_hello; /* but not: */ int l_test, l_hello;
define vars at the beginning of methods
{} blocks are like this:
if (test == 0)
{
exit(1);
}
extensions permited are .h and .cc
no underscore
space replaced with capital letter
should match to class name if there is a class in it.
ex: MyClass.h and MyClass.cc
no underscore
space replaced by capital
start with a small letter
ex: void myFunction()
a function that returns boolean start with the word is.
a function that returns a value but dont change anything start with get.
a function that set a value start with set.
ex:
boolean isOk(); int getValue(); void setValue (int i_value);
starts with a lower case
do not use lower case variable names
it should be easy for everyone to figure out what a variable is only with its name.
boolean variables all starts with 'is'
l prefix is used for local variables
i prefix is used for input parameters
o prefix is used for output parameters
io prefix is used for input/output parameters
member variables doesn't have any prefix
ex:
member variable: myVar local variable: l_myVar input parameter: i_myVar output parameter: o_myVar input/output parameter: io_myVar
upper case
spaces are replaced by underscores
ex:
int MAX_SIZE = 3; #define MAX_SIZE 3