Birth of the style rules

These are the style rules. Setup by the TRoS Development Team (Seniltai and XeryusTC) to enhance readability, and making the coding styles of every programmer in the team synchronous (and the freelancers ofcourse ;)). The style rules are not made to inhibit the creativity or freeness of the programmer, as that will only slow down development and give frustration, instead it is supposed to give a better readability and a better consistency in the code.

Therefore at the creation of this document, the entire team has to agree on a rule unanimously before it will be added to this section to prevent having cumbersome and annoying rules.

Variables

Naming

Variables have a pretty special naming convention in TRoS that hasn't been applied everywhere up to date. There are two kinds of naming conventions on variables depending on the situation.

Example:

class CFoo
{ public:
   int MyPublicVariable;
private:
   int myPrivateVariable;
};
extern int MyGlobalVariable;

Functions

Naming

Function names require to be clear and easy to remember. Every word in a function name has to start with a capital character. And never start function names with a number.

Example:

void FunctionNamesLookLikeThis();

Return type and arguments

There is one flaw in the rule that has been applied to variables, which is quite annoying to read. The problem is that when you make a function that returns a pointer, you would normally have to put the asterisk before the function name. See in the next example why this is wrong.

Example:

// WRONG:
const char *FunctionNowLooksLikeFunctionPointer(const char *MyData);

// RIGHT:
const char* FunctionNowDoesntLookLikeFunctionPointer(const char *MyData).

Comments

Comment your code well, but not to the point that every single line is commented, because then the commenting itself has an opposite effect of what it is supposed to do: increasing readability.

Naming

Comments are required to have a space after the comment-starter (eg. //, /*, //!<, /*! or //!), and they have to start with a capital.

Example:

// A comment looks like this then

Doxygen crawled pages (header files)

Non-Doxygen crawled pages (the others)

Brackets

Classes/Structs

Naming

Example:

class CClassesLookLikeThis { };

Declaration

Enumerations

Naming

Indexing

Enumerations