anonymous structs within structs

DLearner bmqazwsx123 at gmail.com
Mon Dec 4 18:26:07 UTC 2023


Suppose we need a construct like:
```
void main() {

    struct A {
       int I1;
       int I2;
       char X;
    }

    struct B {
       A Dummy;
       int Var1;
       int Var2;
    }
}
```
But do not want to give an explicit name (like 'Dummy' above) to 
the A struct held within the B struct.

Just removing 'Dummy' does not work (Error: no identifier for 
declarator `A`).
Nor does replacing 'Dummy' with {}

Suggestions?



More information about the Digitalmars-d-learn mailing list