Mir

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

Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

My personal preference is for the style we are predominantly using, because it visually separates the constructor parameter list from the initializer list, which can help in some cases:

===== Approved 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}
{
}

===== 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}
{
}

In case the comment formatting is messed up, take a look at http://paste.ubuntu.com/10990296/

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).

« Back to merge proposal