From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=55117 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OqAeq-0005c1-TW for qemu-devel@nongnu.org; Mon, 30 Aug 2010 16:08:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OqAek-0003M0-05 for qemu-devel@nongnu.org; Mon, 30 Aug 2010 16:08:41 -0400 Received: from a.mail.sonic.net ([64.142.16.245]:40185) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OqAej-0003Lk-Lh for qemu-devel@nongnu.org; Mon, 30 Aug 2010 16:08:37 -0400 Message-ID: <4C7C0763.3050208@twiddle.net> Date: Mon, 30 Aug 2010 12:32:51 -0700 From: Richard Henderson MIME-Version: 1.0 Subject: Re: [Qemu-devel] Re: [PATCH 10/14] Zero json struct with memset() instea of = {} to keep compiler happy. References: <1283182547-26116-1-git-send-email-Jes.Sorensen@redhat.com> <1283182547-26116-11-git-send-email-Jes.Sorensen@redhat.com> <4C7BD0CE.6020505@codemonkey.ws> <4C7BD19C.9080308@redhat.com> <4C7BD2E7.2010201@codemonkey.ws> In-Reply-To: <4C7BD2E7.2010201@codemonkey.ws> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: kwolf@redhat.com, Jes Sorensen , qemu-devel@nongnu.org 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~