[Development] commas in ctor-init-lists

Martin Smith Martin.Smith at qt.io
Fri Jun 3 10:07:02 CEST 2016

I think it would be instructive to hear the reasoning of the first engineer to add a ctor-init-list on separate lines with leading commas. I have been in the software engineering business since BEFORE Al Gore invented the internet, yet I have never been temped to start a line with a comma. What devious thinking would cause one to do that in the first place?


From: Development <development-bounces+martin.smith=qt.io at qt-project.org> on behalf of Martin Smith <Martin.Smith at qt.io>
Sent: Friday, June 3, 2016 10:00:26 AM
To: Edward Welbourne; André Somers; development at qt-project.org
Subject: Re: [Development] commas in ctor-init-lists

>Please allow that,

I do, of course. Andre didn't. He wrote...

>> if (blah || boo || foo) {  //no line breaking allowed

...with the comment.

From: Edward Welbourne
Sent: Friday, June 3, 2016 9:54:43 AM
To: Martin Smith; André Somers; development at qt-project.org
Subject: Re: [Development] commas in ctor-init-lists

>> So that means that our C++ code should look like this then?
>> if (blah || boo || foo) {  //no line breaking allowed

> In that case, yes, because the entire expression is short. And the
> ctor example that was used originally would also be on one line. Why
> not? Does the Qt coding standard require each expression to be on a
> separate line? I thought they should be on separate lines when the
> list is too long to be on a single line.

Please allow that, in giving illustrations, short texts may be used as
surrogates for tacitly long ones, so that

  if (blah
      || boo
      || foo) {

is tacitly standing for

  if (somee.really(long.and.complicated, expression)
      || another.such(that, makes, the.line.too.long)
      || and.then.some.more()) {

in examples - it gets boring to write the examples out in full like that
and I would hope everyone is capable of interpolating the big long ugly
expressions for which short tokens are used in illustrations.

Development mailing list
Development at qt-project.org

More information about the Development mailing list