[Development] commas in ctor-init-lists

Sergio Martins sergio.martins at kdab.com
Wed Jun 1 15:15:17 CEST 2016

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.

Subjective reasons against leading commas:
- It's ugly

Subjective reasons against trailling commas:
- It's ugly

Objective reasons in favor of leading commas:
- You get 1 line diffs
- You can comment it out by commenting only 1 line
- Code generators / tooling only have to touch 1 line to add or remove

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

SĂ©rgio Martins | sergio.martins at kdab.com | Senior Software Engineer
Klarälvdalens Datakonsult AB, a KDAB Group company
Tel: Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322)
KDAB - The Qt Experts

More information about the Development mailing list