From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=53230 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oq74I-000464-1z for qemu-devel@nongnu.org; Mon, 30 Aug 2010 12:18:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oq74G-0002mT-M0 for qemu-devel@nongnu.org; Mon, 30 Aug 2010 12:18:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35959) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oq74G-0002mK-EH for qemu-devel@nongnu.org; Mon, 30 Aug 2010 12:18:44 -0400 Message-ID: <4C7BD9DE.8090102@redhat.com> Date: Mon, 30 Aug 2010 18:18:38 +0200 From: Paolo Bonzini 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> In-Reply-To: <4C7BD926.3030704@codemonkey.ws> Content-Type: text/plain; charset=ISO-8859-1; format=flowed 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@redhat.com, qemu-devel@nongnu.org On 08/30/2010 06:15 PM, Anthony Liguori wrote: > On 08/30/2010 10:42 AM, Paolo Bonzini wrote: >> On 08/30/2010 05:35 PM, Jes.Sorensen@redhat.com wrote: >>> - JSONParsingState state = {}; >>> + JSONParsingState state; >>> >>> + memset(&state, 0, sizeof(state)); >>> state.ap = ap; >>> >> >> JSONParsingState state = { .ap = ap }; >> >> achieves the same. > > But the fundamental is, what problem does GCC have with the original? If > there isn't a reasonable answer, then I'm inclined to think this warning > mode is a waste of time. It falls under the "missing fields in initializer" warning. Arguably, an empty initializer should be special cased, but it isn't. I agree that Jes's original patch is ugly, but the C99 initializer is an improvement. Paolo