Skip to content

Document and apply code formatting style #404

@tkoeppe

Description

@tkoeppe

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions