Mir

Code review comment for lp://qastaging/~afrantzis/mir/initializer-list-style

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> My personal preference is for the style we are predominantly using, because it
> visually separates the constructor parameter list from the initializer list,

My personal preference is for what we have in the guide (at least in this case - I disagree with a number of others). Lines that start with a type already look sufficiently different to those that start with a variable name.

...
> ===== Predominant style =====
>
> class C(
> std::shared_ptr<int> const& a_pointer,
> std::shared_ptr<int> const& a_pointer,
> std::shared_ptr<int> const& a_pointer)
> : a_pointer{a_pointer},
> b_pointer{b_pointer},
> c_pointer{c_pointer}

> The downside of the predominant style is that it introduces a special
> formatting rule (normally we would break the line after a special symbol, not
> before it).

The other anomaly it introduces is lines like "b_pointer{b_pointer}," indented to 4n+2 instead of the 4n that we have everywhere else.

Anyone for:

class C(
    std::shared_ptr<int> const& a_pointer,
    std::shared_ptr<int> const& a_pointer,
    std::shared_ptr<int> const& a_pointer)
  : a_pointer{a_pointer},
    b_pointer{b_pointer},
    c_pointer{c_pointer}
{
}

;)

« Back to merge proposal