Hi!

I was wondering if we can have a warning similar to 
-Wmissing-field-initializers but for arrays.
Here's some example of what kind of code would benefit from this warning:


// foo.c
char *foo[5] = {
    "foo",
    "bar",
    "baz"
    //  oops, accidentally the size doesn't match the actual number of fields
};

// foo.h
extern char *foo[5];


Users should be able to trust that each field will be a valid string,
but we have no way to make sure that the array is initialized with strings.

If the initialization is done through designated initializers [...]=..., or 
{0}, it wouldn't warn, as with structs.

I couldn't find an open ticket in bugzilla regarding this.  If you want, I 
could open one.


Does it make sense to you?

Cheers,

Alex

-- 
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to