[webkit-dev] [Styling] Space between [] and () in C++ lambdas

Ryosuke Niwa rniwa at webkit.org
Fri Nov 1 11:24:58 PDT 2019


On Fri, Nov 1, 2019 at 11:19 AM Ryosuke Niwa <rniwa at webkit.org> wrote:

> Hi all,
>
> There seems to be inconsistency in our coding style with regards to
> spacing in lambdas.
>
> Namely, some people write a lambda as:
> auto x = [] () { }
>
> with a space between [] and () while others would write it as:
>
> auto x = []() { }
>
> without a space between the two. I'd like to require either style in our
> guideline so that things are consistent in our codebase. Which one should
> we use?
>
> FWIW, I mildly prefer having a space between [] and ().
>

I forgot to mention that according to Antti
<https://bugs.webkit.org/show_bug.cgi?id=203134#c11>, the existing code in
WebCore places no space between ] and ( with 2:1 ratio.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20191101/ca53e038/attachment.htm>


More information about the webkit-dev mailing list