-
Notifications
You must be signed in to change notification settings - Fork 371
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
Fine tune clang-format proposal #2290
Conversation
Personally I'm ok with most of the style changes/tweaks here. The one thing I'm not a fan of, because I think it doesnt help readability and sometime makes it worse is adding scopes to one-liner |
I don't know if it's out of habit, but indenting function arguments on the same level of the function name, and the carriage return after the first argument can be confusing and maybe less readable? |
@Klaim I've seen it being recommended a few times, as it is helps to avoids bugs when so comes and adds a second line. True it does not change much around
@Hind-M do you prefer the old or new style (or another yet)? |
I prefer this one:
instead of something like:
|
@Hind-M, we currently have this very_long_type very_long_function_name_func(arg1,
other_long_func(very_long_arg_two),
arg3,
...); The proposal is to switch to very_long_type very_long_function_name_func(
arg1,
other_long_func(very_long_arg_two),
arg3,
...
); But indeed not this very_long_type very_long_function_name_func(
arg1,
other_long_func(very_long_arg_two),
arg3,
...); Does that look more reasonable? |
Hmm I still prefer what we have now, but as I said maybe it's because I'm used to it :) |
|
Personally I prefer the proposed indentation, because the current one means there is a lot of code on the right that's a lot of space taken for nothing and I am also more used to something closer to the proposed indentation. In my own projects though I use something closer to the third version rejected, but less expansive on space, but that's anecdotal.
Yeah the automatisation helps use write like this, but I'm not convinced it will prevent any bug due to misreading the code. However as said I'm willing to try so ok. |
LGTM! |
@jonashaag do you agree with these changes? |
2210500
to
986b36f
Compare
986b36f
to
b17c6b5
Compare
This reverts commit 365342c.
This adds new options to clang-format as well as change a few defaults.
(
;private
,public
...)const
,inline
, ...) (withconst
to the left :'( but it seems more accepted)I know it makes a big diff that will create conflicts in PRs, but I think it improve readability.
Let me know what you think (not all formatting end up looking nice, some may need manual rewrite).