[webkit-dev] Initializing member variables
Ryosuke Niwa
rniwa at apple.com
Mon Sep 23 15:37:28 PDT 2024
Looks like the majority opinion is to use { ~ }?
- R. Niwa
> On Sep 23, 2024, at 9:35 AM, Geoff Garen via webkit-dev <webkit-dev at lists.webkit.org> wrote:
>
> +1 for { } because I like catching bugs.
>
> But also: If Chris is right that { } is the only way to handle types without constructors, and the goal is to pick one syntax, then { } is the only possible solution, because standardizing on = would require exceptions for types without constructors.
>
> Thanks,
> Geoff
>
>> On Sep 20, 2024, at 2:29 PM, Yusuke Suzuki via webkit-dev <webkit-dev at lists.webkit.org> wrote:
>>
>> I prefer { } style.
>> It can catch implicit narrowing bugs, which does not work with = style.
>>
>> Best regards,
>> - Yusuke
>>
>>> On Sep 19, 2024, at 4:13 PM, Jean-Yves Avenard via webkit-dev <webkit-dev at lists.webkit.org> wrote:
>>>
>>>
>>>
>>>> On 20 Sep 2024, at 7:55 AM, Ryosuke Niwa via webkit-dev <webkit-dev at lists.webkit.org> wrote:
>>>>
>>>>
>>>> Should we do:
>>>>
>>>> struct Foo {
>>>> int bar = 0;
>>>> }
>>>>
>>>> Or
>>>>
>>>> struct Foo {
>>>> int bar { 0 };
>>>> }
>>>>
>>>> We do both at the moment.
>>>>
>>>> - R. Niwa
>>>
>>> I think `int bar = 0` reads better.
>>>
>>> I only ever see (and use) { } and I thought that was the proper coding style.
>>>
>>> I’m surprised it’s not in our guidelines.
>>>
>>> Jean-Yves
>>> _______________________________________________
>>> webkit-dev mailing list
>>> webkit-dev at lists.webkit.org
>>> https://lists.webkit.org/mailman/listinfo/webkit-dev
>> _______________________________________________
>> webkit-dev mailing list
>> webkit-dev at lists.webkit.org
>> https://lists.webkit.org/mailman/listinfo/webkit-dev
>
> _______________________________________________
> 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/20240923/623743b1/attachment.htm>
More information about the webkit-dev
mailing list