[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: |
Richard Henderson |
Subject: |
Re: [Qemu-devel] Re: [PATCH 10/14] Zero json struct with memset() instea of = {} to keep compiler happy. |
Date: |
Mon, 30 Aug 2010 12:32:51 -0700 |
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 Thunderbird/3.1.2 |
On 08/30/2010 08:48 AM, Anthony Liguori wrote:
> MyDeviceInfo device_infos[] = { {"foo", 0, 2}, {"bar", 0, 1}, {} /*
> or { 0 } */ };
>
> This is such a pervasive idiom that there's simply no way that GCC
> can possibly try to warn against this.
GCC only warns for this if you explicitly ask for it.
I.e. -Wmissing-field-initializers.
That flag is included in -Wextra, which Jes used.
Traditionally this flag is used when you are initializing structures
like the above, but you make a change to the structure involved, so
you may need to update all initializers to take the new field into
account. Some projects have found this idiom useful.
That said, today I'd not bother with this flag and use designated
initializers now.
r~
- [Qemu-devel] [PATCH 09/14] Remove unused arguments for add_aio_request() and free_aio_req(), (continued)
[Qemu-devel] Re: [PATCH 10/14] Zero json struct with memset() instea of = {} to keep compiler happy., Paolo Bonzini, 2010/08/30
- Re: [Qemu-devel] Re: [PATCH 10/14] Zero json struct with memset() instea of = {} to keep compiler happy., Anthony Liguori, 2010/08/30
- Re: [Qemu-devel] Re: [PATCH 10/14] Zero json struct with memset() instea of = {} to keep compiler happy., Paolo Bonzini, 2010/08/30
- Re: [Qemu-devel] Re: [PATCH 10/14] Zero json struct with memset() instea of = {} to keep compiler happy., Anthony Liguori, 2010/08/30
- Re: [Qemu-devel] Re: [PATCH 10/14] Zero json struct with memset() instea of = {} to keep compiler happy., Paolo Bonzini, 2010/08/30
- Re: [Qemu-devel] Re: [PATCH 10/14] Zero json struct with memset() instea of = {} to keep compiler happy., Jes Sorensen, 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