While trying to compile coreutils with -Wextra,
I noticed many warnings due to automatic variables
initialized with { 0, }.

As I understand it, since C90 the above will initialize
[all members of] the type to that used in static scope,
including any unused padding space in the structure.

I.E. the following is valid:

mbstate_t m = { 0, };
int i = { 0, };
struct { int a; int b; } s = { 0, };

It would be great if gcc would relax this warning
when a trailing ',' is specified as that would be clear indication
that one wants to init all [other] elements to 0, and that
we haven't just forgotten some members.

At least the warning should be suppressed for the specific
most common case is where { 0, } is specified.

thanks.


-- 
           Summary: -Wmissing-field-initializers relaxation request
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: P at draigBrady dot com
 GCC build triplet: i386-redhat-linux
  GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36750

Reply via email to