From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=44868 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oq8jI-0003nc-RK for qemu-devel@nongnu.org; Mon, 30 Aug 2010 14:05:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oq8jH-0004Zv-JS for qemu-devel@nongnu.org; Mon, 30 Aug 2010 14:05:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39703) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oq8jH-0004Zn-Bh for qemu-devel@nongnu.org; Mon, 30 Aug 2010 14:05:11 -0400 Message-ID: <4C7BF2CF.10804@redhat.com> Date: Mon, 30 Aug 2010 20:05:03 +0200 From: Jes Sorensen 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> <4C7BD16F.1030301@redhat.com> <4C7BD926.3030704@codemonkey.ws> <4C7BD9DE.8090102@redhat.com> <4C7BDC84.9070906@codemonkey.ws> In-Reply-To: <4C7BDC84.9070906@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, Paolo Bonzini , qemu-devel@nongnu.org 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