[PATCH] D14484: Formatting constructor initializer lists by putting them always on different lines

Robert F-C via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 26 04:27:39 PDT 2019


rfairliecuninghame added a comment.

I also think this feature bears further consideration.

I understand that google and other coding standard currently allows this, but I feel there's a certain degree of inconsistency in their doing so. 
None of the open main coding standards would recommend or allow putting multiple variable initializations/assignments per line but this is effectively what is occurring in allowing this. 
After all,

  MyClass::MyClass(long _state1Long, short _state2Short, int *_state3Ptr)
    : state1Long(_state1Long), state2Short(_state2Short), state3Ptr(*_state3Ptr) {
  }

is conceptually much the same as

  MyClass::MyClass(long _state1Long, short _state2Short, int *_state3Ptr) {
    state1Long = _state1Long; state2Short = _state2Short; state3Ptr = *_state3Ptr;
  }

which you would of course never allow.
I'm sure this conceptual inconsistency is apparent to a fair number of other C++ style guide writers where a one-per-line limitation on constructor initializers is mandated. [I'm in a similar position to JVApen and have had to patch the program to order to meet this requirement at my workplace.] Anyway, just an observation on the matter.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D14484/new/

https://reviews.llvm.org/D14484





More information about the cfe-commits mailing list