How to handle nested structs when converting C headers?

Adam D. Ruppe destructionator at gmail.com
Wed Dec 11 14:56:33 PST 2013


On Wednesday, 11 December 2013 at 22:54:04 UTC, Adam D. Ruppe 
wrote:
> Nested structs and unions like in your example are supported in 
> D too, same syntax, same effect.

Actually, no, not quite the same syntax, I didn't notice the name 
at the end of the C one (in D, the anonymous nested structs and 
unions are supported).

But almost the same then: make them a nested type with a name 
after the struct or union keyword then the member. So

     struct TwoPtrValue {                /*   - internal rep as 
two pointers. */
             VOID *ptr1;
             VOID *ptr2;
         }
      TwoPtrValue twoPtrValue;

that's how I'd do it


More information about the Digitalmars-d-learn mailing list