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