Anonymous structure
Nicholas Wilson via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Apr 17 19:42:15 PDT 2016
On Monday, 18 April 2016 at 02:12:24 UTC, Tofu Ninja wrote:
> Just out of curiosity, what is the point of the following?
>
> struct a{
> struct{
> int x;
> int y;
> int z;
> }
> }
>
> As far as I can tell, the anonymous structure does nothing. How
> is it different from
>
> struct a{
>
> int x;
> int y;
> int z;
> }
>
IIRC D doesn't allow anonymous structures.
> Also is there a way to have a named substructure, not a nested
> structure but something to just add an additional name, maybe
> something like
> struct a{
> struct{
> int x;
> int y;
> int z;
> } b;
> }
Try adding static:
struct a
{
static struct b
{
}
}
More information about the Digitalmars-d-learn
mailing list