On 08/30/2010 08:48 AM, Anthony Liguori wrote:
> MyDeviceInfo device_infos[] = { {"foo", 0, 2}, {"bar", 0, 1}, {} /*
> or { 0 } */ };
> 
> This is such a pervasive idiom that there's simply no way that GCC
> can possibly try to warn against this.

GCC only warns for this if you explicitly ask for it.
I.e. -Wmissing-field-initializers.

That flag is included in -Wextra, which Jes used.

Traditionally this flag is used when you are initializing structures
like the above, but you make a change to the structure involved, so
you may need to update all initializers to take the new field into
account.  Some projects have found this idiom useful.

That said, today I'd not bother with this flag and use designated
initializers now.


r~

Reply via email to