[Bug c/39525] New: [easy to fix bug] Docs for C99 "designated initializers" isn't clear what happens to omitted field members

mnemo at minimum dot se gcc-bugzilla@gcc.gnu.org
Mon Mar 23 11:10:00 GMT 2009


The documentation for C99 "designated initializers" is not clear what happens
to omitted field members. I'm fairly sure omitted field members get initialized
to the same value they would get if they were static but it would be very nice
to have this explicitly called out in the docs.

The documentation page I'm referring to is available here:
http://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html

In particular I would like the documentation to explain what the values of

struct my_struct { bool a; int b; double c; };
struct my_struct ms = { .b = 42 };

At this point, what is the values of ms.a and ms.c? As I mention above, I
suspect the answer is that they have been initialized to the same values that
the corresponding data types would get if they were static variables? i.e.
false and 0.0, no?


-- 
           Summary: [easy to fix bug] Docs for C99 "designated initializers"
                    isn't clear what happens to omitted field members
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mnemo at minimum dot se


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



More information about the Gcc-bugs mailing list