Skip to content
This repository has been archived by the owner on Nov 5, 2018. It is now read-only.

Code Style

nvllvs edited this page Jan 27, 2017 · 2 revisions

Code Style

If you want your pull request to be accepted into AimTux make sure your code style is as follows:

====================

Use tabs instead of spaces

If your IDE/editor isn't defaulting to tabs please change it to do so.

Pascal Case

Use:

  • functions/methods
  • struct names
  • class names
  • namespace names
MyAwesomeFunctionName();

struct MyStruct
{
};

class MyClass
{
};

namespace MyNamespace
{
}

Camel Case

Use:

  • Variables
  • Parameters

The first character must be lowercase

int myIntName;
int somethingOther;

void Something(int somethingOther);

Preprocessors

Preprocessor names should be in all caps as standard in C/C++.

All preprocessors shouldn't be indented.

#define MY_PREPROCESSOR_NAME true

while (true)
{
#if MY_PREPROCESSOR_NAME
    // Write something here...
    int i = 0;
#endif
}

Curly braces

All curly braces ({ }) should be on it's own line.

if (true)
{
    while (true)
    {
        // Something...
    }
}

Pointers and references

When defining a pointer, put the asterisk on the left side, touching the type name.

void* myPointer;
uint32_t* someRandomIntPointer;

void SomeMethod(uint32_t& myReference);