[cfe-dev] Designated initialization warns if struct members are not in declaration order

Eli Friedman eli.friedman at gmail.com
Thu Oct 16 17:27:30 PDT 2008

On Thu, Oct 16, 2008 at 3:50 PM, Sascha Wildner <swildner at erpicon.de> wrote:
> "Each brace-enclosed initializer list has an associated current object.
> When no designations are present, subobjects of the current object are
> initialized in order according to the type of the current object: array
> elements in increasing subscript order, structure members in declaration
> order, and the first named member of a union. In contrast, a designation
> causes the following initializer to begin initialization of the
> subobject described by the designator. Initialization then continues
> forward in order, beginning with the next subobject after that described
> by the designator."

Designators currently get ignored by the parser.  There's been some
discussion of how to implement it; unfortunately, it ends up being
relatively complicated, and nobody has gotten around to it.

It would probably be a good idea to add a warning as an interim measure, though.


More information about the cfe-dev mailing list