Am Mittwoch, dem 22.01.2025 um 16:25 +0100 schrieb Michael Matz:
> Hello,
> 
> On Wed, 22 Jan 2025, Martin Uecker wrote:
> 
> > > You need to decide which is which after seeing the ".".  I'm guessing 
> > > what 
> > > you mean is that on seeing ".ident" as first two tokens inside in 
> > > initializer-list you go the designator route, and not the 
> > > initializer/assignment-expression route, even though the latter can now 
> > > also start with ".ident".  
> > 
> > What I mean is that after parsing the dot followed by an identifier x, 
> > if x is the name of a member of the structure S which is being initialized,
> > it is  a designator, otherwise it is an expression that uses .x to refer
> > to some member of an enclosing definition.
> 
> So, as I guessed.

I think you missed the part that you can lookup whether x is
a member of the struct S.

> 
> > So you do not need to look further.  But maybe I am missing something 
> > else.
> 
> Like ...
> 
> > > Note further that you may have '{ .y[1][3].z }', which is still not a 
> > > designation, but an expression under your proposal, whereas
> > > '{ .y[1][3].z = 1 }' would remain a designation.  This shows that you 
> > > now need arbitrary look-ahead to disambiguate the two.  A Very Bad Idea.
> 
> ... this?

In .y[1][3].z  after .y you can decide whether y is a member of the
struct being initialized.  If it is, it is a designator and if not
it must be an expression.

Martin





Reply via email to