[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] Re: [PATCH 10/14] Zero json struct with memset() instea
From: |
Jes Sorensen |
Subject: |
Re: [Qemu-devel] Re: [PATCH 10/14] Zero json struct with memset() instea of = {} to keep compiler happy. |
Date: |
Mon, 30 Aug 2010 20:05:03 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.8) Gecko/20100806 Fedora/3.1.2-1.fc13 Lightning/1.0b2pre Thunderbird/3.1.2 |
On 08/30/10 18:29, Anthony Liguori wrote:
> On 08/30/2010 11:18 AM, Paolo Bonzini wrote:
>> It falls under the "missing fields in initializer" warning. Arguably,
>> an empty initializer should be special cased, but it isn't.
>
> So the warning is for old style initializer lists? I disagree that it's
> a valid warning. First, {} is ambiguous as it can be an empty list of
> c99 initializers and an empty list of c89 initializers.
>
> But even for c89 initializers, it's very common practice to omit
> initializers and rely on the defaulted value. For instance, { 0 } is
> quite pervasive as an idiom.
>
>>
>> I agree that Jes's original patch is ugly, but the C99 initializer is
>> an improvement.
>
> Yes, I'm fine with your patch on it's own but I disagree with GCC's
> warnings here.
So if we pulled in Paolo's version instead, would you be happy with that?
Personally I find the memset approach prettier since it's explicit what
it does, but that is obviously down to personal preference.
Cheers,
Jes
[Qemu-devel] Re: [PATCH 10/14] Zero json struct with memset() instea of = {} to keep compiler happy., Paolo Bonzini, 2010/08/30
[Qemu-devel] [PATCH 11/14] Remove unused function arguments, Jes . Sorensen, 2010/08/30
[Qemu-devel] [PATCH 02/14] Respect return value from nbd_client(), Jes . Sorensen, 2010/08/30
[Qemu-devel] [PATCH 13/14] Change DPRINTF() to do{}while(0) to avoid compiler warning, Jes . Sorensen, 2010/08/30
[Qemu-devel] [PATCH 14/14] load_multiboot(): get_image_size() returns int, Jes . Sorensen, 2010/08/30
[Qemu-devel] [PATCH 07/14] Remove unused argument for get_whole_cluster(), Jes . Sorensen, 2010/08/30
[Qemu-devel] [PATCH 03/14] Fix repeated typo: was "end if list" instead of "end of list", Jes . Sorensen, 2010/08/30
[Qemu-devel] [PATCH 04/14] Zero initialize timespec struct explicitly, Jes . Sorensen, 2010/08/30