|
From: | Paolo Bonzini |
Subject: | Re: [Qemu-devel] Re: [PATCH 10/14] Zero json struct with memset() instea of = {} to keep compiler happy. |
Date: | Mon, 30 Aug 2010 18:35:58 +0200 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100621 Fedora/3.0.5-1.fc13 Lightning/1.0b2pre Mnenhy/0.8.3 Thunderbird/3.0.5 |
On 08/30/2010 06:29 PM, Anthony Liguori wrote:
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.
Yes, that's what I meant. {} should be special cased as an empty list will rarely be a bug, even when C89 initializers are used.
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.
That's why the warning is only in -Wextra. Those are warnings that may clash with someone's style conventions.
Paolo
[Prev in Thread] | Current Thread | [Next in Thread] |