[Development] Coding style for lambdas, particularly their open-brace

Edward Welbourne edward.welbourne at qt.io
Fri Aug 18 14:17:07 CEST 2017


Hi all,

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 ?
(How long do I have to wait before I can claim lazy consensus ?)

	Eddy.



More information about the Development mailing list