On Thu, 10 Nov 2022, Martin Uecker via Gcc wrote:
> One problem with WG14 papers is that people put in too much,
> because the overhead is so high and the standard is not updated
> very often. It would be better to build such feature more
> incrementally, which could be done more easily with a compiler
> extension. One could start supporting just [.x] but not more
> complicated expressions.
Even a compiler extension requires the level of detail of specification
that you get with a WG14 paper (and the level of work on finding bugs in
that specification), to avoid the problem we've had before with too many
features added in GCC 2.x days where a poorly defined feature is "whatever
the compiler accepts".
If you use .x as the notation but don't limit it to [.x], you have a
completely new ambiguity between ordinary identifiers and member names
struct s { int a; };
void f(int a, int b[((struct s) { .a = 1 }).a]);
where it's newly ambiguous whether ".a = 1" is an assignment to the
expression ".a" or a use of a designated initializer.
(I think that if you add any syntax for this, GNU VLA forward declarations
are clearly to be preferred to inventing something new like [.x] which
introduces its own problems.)
--
Joseph S. Myers
[email protected]