[cfe-dev] -Wmissing-field-initializers

Eli Friedman eli.friedman at gmail.com
Mon Feb 20 13:06:21 PST 2012


On Mon, Feb 20, 2012 at 12:40 PM, Sean McBride <sean at rogue-research.com> wrote:
> On Mon, 20 Feb 2012 12:16:36 -0800, John McCall said:
>
>>-Wmissing-field-initializers does have a special case for intentional
>>uses of the language's default-zero-initialization rules.  However, that
>>special case is spelled {}, not {0}.  If you feel that this is a really
>>common idiom for zero-initialization, we could also add it, but I'd
>>really prefer not to, because it neuters -Wmissing-field-initializers on
>>an interesting class of bugs.
>
> But using {}, as you suggest, gives:
>
> warning: use of GNU empty initializer extension [-pedantic,-Wgnu]
>
> One seems trapped between one warning or the other.

Only in C; C++ allows {}.

-Eli




More information about the cfe-dev mailing list