Can now use alias for collapsing multiple fields in nested structs

Derek Fawcus dfawcus+dlang at employees.org
Tue Jan 7 10:10:19 UTC 2025


The main issue with a C style anonymous struct and definition

```C
struct outer {
    struct {
       int a;
    } instance;
}
```

Would be the grammar point previously mentioned, making the above 
incompatible, due to structs within structs not requiring 
terminating semi-colons.

Changing that in general would be too big a breaking change to be 
viable.

Depending upon how much use is currently made of D style 
'anonymous structs', the one possibility I could see is changing 
the grammar to require such to have a trailing semi-colon.  This 
is also a breaking change, but possibly it would be viable if the 
current D style anonymous structs are not commonly used.

However at this stage, I'd be inclined just to say forget about 
it.

The C style can be handled by ImportC, albeit any .di file 
generated by such can not express the concept.

So if one wishes to have this form used, one simply needs to have 
mixed C and D program.



More information about the Digitalmars-d mailing list