Code Style Guidelines

Everything about development and the OpenMW source code.
Locked
User avatar
lgromanowski
Site Admin
Posts: 1193
Joined: 05 Aug 2011, 22:21
Location: Wroclaw, Poland
Contact:

Code Style Guidelines

Post by lgromanowski »

ape wrote: Like somewhere else mentioned in this forum:

It would be nice to have some code style guidelines to improve code readability etc.

The actual reason is that i've some problems with kdevelop4 that are annoying me :D (sometimes scopes are indented 2 spaces others 4 and kdevelop doesn't notice that). If there would be a guideline i could tweak my ide to use that.
Zini wrote: We pretty much agreed on using 4 spaces. There is some old code with only 2 spaces though. If you find new code with only 2 spaces, complain to Nico (since he seems to be the only one who has used these settings).
ape wrote: Alright and what about braces and method declarations and calls (concerning spaces)?
Should they be formated like this?

Code: Select all

float& myCalcFunction(float p1, float p2)
{
    myClass->doSomething(p1, p2);
}

Zini wrote: Yes.
ap0 wrote: I have add a small article about thsi in the wiki : http://openmw.org/wiki/index.php?title= ... _Reference
Locked