Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pointer alignment #7

Open
xhernandez opened this issue May 3, 2018 · 3 comments
Open

Pointer alignment #7

xhernandez opened this issue May 3, 2018 · 3 comments

Comments

@xhernandez
Copy link
Contributor

xhernandez commented May 3, 2018

We currently align pointers to the right (just before the variable name) like this:

void *ptr;

This is achieved by PointerAlignment: Right in .clang-format.

However this has an incompatibility with another option we commonly use:

AlignConsecutiveDeclarations: true

With these options we get this:

void
test_function(void *arg)
{
    int32_t num;
    void *  ptr;
}

So the pointer is not correctly aligned on declarations. We can live with this or change one of the options.

With AlignConsecutiveDeclarations: false:

void
test_function(void *arg)
{
    int32_t num;
    void *ptr;
}

With PointerAlignment: Middle:

void
test_function(void * arg)
{
    int32_t num;
    void *  ptr;
}

With PointerAlignment: Left:

void
test_function(void* arg)
{
    int32_t num;
    void*   ptr;
}

@aravindavk @nigelbabu @amarts @jdarcy

@aravindavk
Copy link
Contributor

Space after pointer looks odd. AlignConsecutiveDeclarations: false looks good to me.

PointerAlignment: Right
AlignConsecutiveDeclarations: false

@xhernandez
Copy link
Contributor Author

I Added a PR #10 to change the declarations alignment and escaped new lines alignment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants