-
Notifications
You must be signed in to change notification settings - Fork 405
Code style conventions
Don't worry since this is no big project there are not so many code style conventions. However, it would be nice if the following conventions could be followed. If you see something that does not comly feel free to correct it.
Always use 2 spaces to indent something. Never use tabs since they always look different depending on your IDE.
Unix style LF. UTF8 file encoding.
Use the following style for curly brackets:
if (somethingIsTrue)
{
int i=0;
i += 2;
}
If there is only one line of code you can also write:
if (somethingIsTrue)
doSomething();
Since the project already uses a lot of CamelCase styled variables we will stick to this. I know there are good reasons to use snake_case but that would require a lot of changes to the existing code.
Don't mark class members with any prefix. E.g:
int iSomeName; // Don't
int p_privateClassMember; // Also don't
int m_anotherClassMember; // No
If you have a modern IDE it can tell you what type/class the variable you are looking at is a member of. If you want to you can probably also configure it to highlight class members dirrefently compared to local variables so there is really no reason to put it in the name.