Skip to content

Conversation

ljbade
Copy link
Contributor

@ljbade ljbade commented Mar 30, 2022

While working on our fork I noticed an annoying issue where clang-format wasn't consistently left aligning references and pointers. I only noticed this as our own code uses right aligned style so I was doing that by habit until I noticed the a mix of alignment.

It seems by default clang-format will try to derive the alignment based on what it finds already in a file. I changed the .clang-format to force always left aligned and it found a few files with mixed alignment.

.clang-format Outdated
@@ -1 +1,3 @@
BasedOnStyle: Google
DerivePointerAlignment: false
PointerAlignment: Left
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please remove the explicit PointerAlignment here? It seems to be the default:

$ clang-format --style=Google -dump-config|grep PointerAlign
DerivePointerAlignment: true
PointerAlignment: Left

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@ljbade ljbade force-pushed the ljbade/clang-format branch from 16e64f7 to a89bd23 Compare March 30, 2022 09:11
@gjasny gjasny merged commit 1707ea4 into jupp0r:master Mar 30, 2022
@gjasny
Copy link
Collaborator

gjasny commented Mar 30, 2022

Thank you for the contribution!

@ljbade ljbade deleted the ljbade/clang-format branch April 1, 2022 00:52
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

Successfully merging this pull request may close these issues.

2 participants