[Development] Coding style for lambdas, particularly their open-brace
Edward Welbourne
edward.welbourne at qt.io
Tue Sep 19 14:27:59 CEST 2017
On Fri, Aug 18, 2017 at 2:17 PM, Edward Welbourne <edward.welbourne at qt.io<mailto:edward.welbourne at qt.io>> wrote:
>> We have a draft policy for lambdas at [0], in a section that begins with
>>
>> Note: This section is not an accepted convention yet.
>> This section serves as baseline for further discussions.
>>
>> That section is now a quarter decade old; it's had a few updates since
>> it was added (2015-02-27), so may fairly be said to be evolving (albeit
>> it's had more formatting changes than substantive ones); but perhaps
>> it's about time we agreed that at least its low-level bits about
>> formatting can be promoted to [1], without such a caveat.
>>
>> * [0] https://wiki.qt.io/Coding_Conventions#Conventions_for_C.2B.2B11_usage
>> * [1] https://wiki.qt.io/Qt_Coding_Style#Braces
>>
>> In particular, I'd like to (at least) amend the first exception in [1],
>>
>> Function implementations and class declarations always have the left
>> brace on the start of a line:
>>
>> to include "(but not lambdas)" in a judicious place, so that lambdas are
>> excluded from the exception and fit into our general pattern, putting
>> the open-brace on the same line as its controlling preamble: e.g.
>>
>> Function implementations (but not lambdas) and class declarations
>> always have the left brace on the start of a line:
>>
>> Does anyone object to this minimal change ?
Mark Gaiser (18 August 2017 16:11) added:
> The explicit return type rule should probably be changed, as that was
> for VS2010. And that compiler has been dropped in 5.7.
Having heard no opposition to this in a month (and the same topic having
come up again) I have now implemented the two changes mentioned above.
* [0] https://wiki.qt.io/index.php?title=Coding_Conventions&type=revision&diff=31578&oldid=31083
* [1] https://wiki.qt.io/index.php?title=Qt_Coding_Style&type=revision&diff=31577&oldid=31425
Eddy.
More information about the Development
mailing list