You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As I was working an the other Issues, i thought it would be nice to have a .clang-format file.
Nowadays, that is almost the first thing I do in a new project.
I tried to create a .clang-format file that exactly matches the current style but hit a problem.
It is currently not possible to indent the class access modifier as it's own entity.
So, something like this cannot be done (at the moment, clang < version 12):
classA {
public:intdo_something();
};
What could be done is to indent the function definition with 4 spaces and offset the access modifier with 1 or two:
classA {
public:intdo_something();
};
I honestly would prefer it that way because I think the four spaces here (8 spaces from class to function definition) is a little to much. But because that changes the style you chose, I would understand that you disagree!
I obviously prefer the style that I chose but if it cannot be done with clang-format then it can be changed. It seem that I misunderstood something you wrote, because the link you provided shows that custom indentation can be given to access modifiers. Can you explain what you meant by "not possible to indent the class access modifier as it's own entity"?
I meant that class modifiers like "public:", "private:" and "protected:" have no identation option in the config file.
So if we set IndentWidth to 4 the class will just look like this:
This seems to be changed in Clang Version 12, there they added an option called: IndentAccessModifiers: true.
But I am not sure when this will be released or if this option will stay.
jrsnen
added
dev
Developing uvgRTP is easier, but these features are not visible to users of the library
and removed
feature
New feature
labels
Mar 1, 2022
As I was working an the other Issues, i thought it would be nice to have a .clang-format file.
Nowadays, that is almost the first thing I do in a new project.
I tried to create a .clang-format file that exactly matches the current style but hit a problem.
It is currently not possible to indent the class access modifier as it's own entity.
So, something like this cannot be done (at the moment, clang < version 12):
What could be done is to indent the function definition with 4 spaces and offset the access modifier with 1 or two:
I honestly would prefer it that way because I think the four spaces here (8 spaces from class to function definition) is a little to much. But because that changes the style you chose, I would understand that you disagree!
There is a good explanation of that problem here: https://stackoverflow.com/questions/29198963/how-can-i-tell-clang-format-to-indent-visibility-modifiers
Any thoughts ?
The text was updated successfully, but these errors were encountered: