On Wednesday 01 June 2016 15:15:17 Sergio Martins wrote:
> On Wednesday, 1 June 2016 14:41:30 WEST Marc Mutz wrote:
> > Hi,
> > 
> > There seems to have been a silent underground move to uglify the Qt
> > sources , by using commas to introduce lines
> > . I have no idea where this came from
> > , but it looks butt
> > -ugly and it is in violation of http
> > (http://wiki.qt.io/Qt_Coding_Style#Line_breaks 2nd item: "Commas go at
> > the _end_ of wrapped lines")
> 
> I think that refers to function calls and wasn't written with ctor
> init-lists in mind, but we can improve it so it stops being a violation.

I'm pretty sure it was written with ctor-init-lists in mind, because all of 
QtBase uses trailing comma. I only come across the leading comma version in 
new modules.

> Subjective reasons against leading commas:
> - It's ugly
> 
> Subjective reasons against trailling commas:
> - It's ugly

I beg your pardon? Trailing commas are ugly? So where's the text editor that 
folds prose text to have commas on the next line?

> Objective reasons in favor of leading commas:
> - You get 1 line diffs

You get the same when you insert fields in the middle. Only at the end there's 
a difference.

> - You can comment it out by commenting only 1 line
> - Code generators / tooling only have to touch 1 line to add or remove

All these are also valid for enums and function argument lists, but I see no-
one doing similar things for enums and functions.

If those reasons were strong enough to do away with 100s of years of 
typesetting history, why don't we use it for functions, too:

   func(
         loooooooooooooooooooooooooooooooooongarg1
       , loooooooooooooooooooooooooooooooooooooooooooonerarg2
       , looooooooooooooooooooooooooooooongestarg3
        );

Hmm, sweet...

> Weren't these reasons even a motivation for C++11 to support "trailling
> enum comma" ?

Yes, and we should wait for / propose that they do the same change for ctor-
init-list, too. Not apply some horrible work-around.

Thanks,
Marc

-- 
Marc Mutz <marc.m...@kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
Tel: +49-30-521325470
KDAB - Qt, C++ and OpenGL Experts
_______________________________________________
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to