[PATCH v1] Silence -Wzero-as-null-pointer-constant diagnostics
Florian Weimer
fweimer@redhat.com
Fri Nov 15 21:17:53 GMT 2024
* Joseph Myers:
> On Fri, 15 Nov 2024, Florian Weimer wrote:
>
>> * Alejandro Colomar:
>>
>> > Hi Xi,
>> >
>> > On Fri, Nov 15, 2024 at 08:42:47PM GMT, Xi Ruoyao wrote:
>> >> If you want to mean literally "zero-initializing a struct" you should
>> >> use {} instead of 0, but doing so is only supported in C23 or as a GNU
>> >> extension.
>> >
>> > Is {} acceptable within glibc's source code? Or should I take a
>> > different approach?
>>
>> It's acceptable outside of installed headers.
>
> For structures / unions / arrays, that is. Scalar initializers {} would
> be problematic because they've only been supported since GCC 13.
Agreed, thanks for the correction.
Florian
More information about the Libc-alpha
mailing list