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

Daniel Dunbar daniel at zuster.org
Thu Oct 16 19:16:14 PDT 2008


Yes, we should add this soon, its pretty bad and confusing. I would actually
prefer an error to a warning, since I would much rather deal with complaints
about clang not working than complaints about hard to find miscompilations.
Does anyone object to an error on designated initializers until it gets
implemented?

 - Daniel

On Thu, Oct 16, 2008 at 5:27 PM, Eli Friedman <eli.friedman at gmail.com>wrote:

> 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.
>
> -Eli
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20081016/6fc56993/attachment.html>


More information about the cfe-dev mailing list