On 4/13/18 4:22 PM, Boris Zbarsky wrote:
So my take is that we should not use braced initializer syntax in constructor initializer lists.  The reason for that is that it makes it much harder to scan for where the constructor body starts.

I don't think that's true in the general case where the braces remain to the right of the identifier in the same line, fwiw, but...

Doubly so when ifdefs in the initializer list are involved. > Triply so when 
someone writes it as:

   explicit TTextAttr()
     , mIsRootDefined
   {
     false
   }
#ifdef SOMETHING
#endif
   {
   }

which is what clang-format did in some of the cases in the patch for bug 525063.

... this is definitely terrible I agree :(

In particular, I think this should have just used:

   , mIsRootDefined(false)

Agreed in this case (specially given there were previous members initialized with parenthesis, and the braces are not really necessary).

I don't have a strong opinion about the one space when we do use the braced initializer syntax.  But we should make sure we don't end up with the above monstrosity where it looks like the ctor body.

I filed https://bugzilla.mozilla.org/show_bug.cgi?id=1453973 for that.

-Boris
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to