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

Document and apply code formatting style #404

Open
tkoeppe opened this issue Nov 15, 2014 · 1 comment
Open

Document and apply code formatting style #404

tkoeppe opened this issue Nov 15, 2014 · 1 comment

Comments

@tkoeppe
Copy link
Contributor

tkoeppe commented Nov 15, 2014

Several details of code formatting are inconsistent at the moment.

The first step should be to document the desired style on the wiki; then we can clean up the main text by applying the documented style.

Here are some items I noticed repeatedly:

  • template <class T, class U = T> struct Foo<T, U>
    • space between template <
    • no space in template specializations, Foo<T, U>
    • space around = in U = T
  • f(a, b , c)
    • space after comma, not before
    • no space before the leading parenthesis in function call expressions
  • Generally, spaces around binary operators except for comma.
  • Space before leading parenthesis in control structures (for, while, if).
  • No spaces between closing template brackets: Foo<Bar<T>>. I think there's a separate issue open for this already, but it should go into the style guide in any case.

I think many of those rules are fairly easy to check globally with grep, and so the cleanup shouldn't be terribly difficult or protracted.

@jensmaurer
Copy link
Member

See #53 for the spacing in the "template" case, with the result
"use template< not template < (41% vs 59%, but we prefer the former)."

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