Can now use alias for collapsing multiple fields in nested structs

ryuukk_ ryuukk.dev at gmail.com
Mon Dec 30 12:08:53 UTC 2024


On Sunday, 29 December 2024 at 04:10:13 UTC, Walter Bright wrote:
> On 12/28/2024 5:23 PM, Derek Fawcus wrote:
>> It was... That particular preprocessor game largely became 
>> unnecessary once we gained C11 anonymous structs and unions.
>
> D had anonymous structs and unions long before C11.
>
> BTW, I did find an appropriate use for it in the backend, 
> unfortunately I can't use it because the bootstrap compiler is 
> old old old.

```D
struct Tada {
     struct {
         int a;
         int b;
     } data;
};


Tada tada;
tada.data.a = 42;
```

but D can't do that

"who did it first" is not something people care about


More information about the Digitalmars-d mailing list