On Wed, 17 May 2023 09:44:47 GMT, Kim Barrett <[email protected]> wrote:
>> os_aix.cpp:460:37: error: missing field 'gid' initializer
>> [-Werror,-Wmissing-field-initializers]
>> struct shmid_ds shm_buf = { 0 };
>>
>> ={} seems to work, but I do not know if it works on every compiler because
>> standard says: the initializer must be a **non-empty, (until C23)**
>> brace-enclosed, comma-separated list of initializers for the members.
>> Should I then disable Warning missing-field-initializers?
>
> Use
>
> struct shmid_ds shm_buf{};
>
> to _value-initialize_. Calls the default constructor if there is one.
> Otherwise, performs _zero-initialization_,
> which is what we want here.
The final suggested change (to value-initialize the object) seems to have *not*
been made.
However, I think it doesn't matter. The mentioned restriction against being
non-empty until C23 is not relevant.
This is C++, not C. Empty initializers are, and have always been, permitted by
C++.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13953#discussion_r1197956866