We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
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.
PointerAlignment: Right
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:
AlignConsecutiveDeclarations: false
void test_function(void *arg) { int32_t num; void *ptr; }
With PointerAlignment: Middle:
PointerAlignment: Middle
void test_function(void * arg) { int32_t num; void * ptr; }
With PointerAlignment: Left:
PointerAlignment: Left
void test_function(void* arg) { int32_t num; void* ptr; }
@aravindavk @nigelbabu @amarts @jdarcy
The text was updated successfully, but these errors were encountered:
Space after pointer looks odd. AlignConsecutiveDeclarations: false looks good to me.
PointerAlignment: Right AlignConsecutiveDeclarations: false
Sorry, something went wrong.
https://stackoverflow.com/questions/38392889/clang-format-align-asterisk-of-pointer-declaration-with-variable-name
I Added a PR #10 to change the declarations alignment and escaped new lines alignment.
No branches or pull requests
We currently align pointers to the right (just before the variable name) like this:
This is achieved by
PointerAlignment: Right
in .clang-format.However this has an incompatibility with another option we commonly use:
With these options we get this:
So the pointer is not correctly aligned on declarations. We can live with this or change one of the options.
With
AlignConsecutiveDeclarations: false
:With
PointerAlignment: Middle
:With
PointerAlignment: Left
:@aravindavk @nigelbabu @amarts @jdarcy
The text was updated successfully, but these errors were encountered: