[webkit-dev] [Styling] () for a lambda without arguments (Was Space between [] and () in C++ lambdas)

Zalan Bujtas zbujtas at gmail.com
Fri Nov 1 20:06:36 PDT 2019


I've been using the short form in the layout code for a while now and never
mistaken it for code block start & end.
That being said I don't have strong preference on this.

Alan.

On Fri, Nov 1, 2019 at 4:37 PM Ryosuke Niwa <rniwa at webkit.org> wrote:

> On Fri, Nov 1, 2019 at 11:53 AM Michael Catanzaro <mcatanzaro at gnome.org>
> wrote:
>
>> On Fri, Nov 1, 2019 at 11:19 am, Ryosuke Niwa <rniwa at webkit.org> wrote:
>> > Namely, some people write a lambda as:
>> > auto x = [] () { }
>> >
>> > with a space between [] and () while others would write it as:
>> >
>> > auto x = []() { }
>>
>> ��: I omit the () when there are no parameters, as in these examples.
>>
>
> I guess that's another thing we should decide. Should we, or should we not
> have () when there are no arguments.
>
> I think we usually err on the side of more concise form but I do prefer
> having () so that it's clear it's a function. Otherwise, it can look like a
> code block start & end.
>
> - R. Niwa
>
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20191101/a6e971e9/attachment.htm>


More information about the webkit-dev mailing list