D - Feature request: <struct>.offsetof(<member>) property
- Dan Liebgold <Dan_member pathlink.com> Feb 24 2003
- "Achilleas Margaritis" <axilmar in.gr> Feb 24 2003
- "Walter" <walter digitalmars.com> Feb 24 2003
What I would like to have is a <type>.offsetof(<datamember>) property for struct or union types. In C/C++ the preprocessor is used for this purpose, for example (from windows): #define FIELD_OFFSET(type, field) ((ulong)(ulong*)&(((type *)0)->field)) Is there currently a way to do this in D? Dan
Feb 24 2003
Good idea. Maybe it can be done in an OO way as a static property: <struct>.<member>.offset "Dan Liebgold" <Dan_member pathlink.com> wrote in message news:b3cluc$23e8$1 digitaldaemon.com...What I would like to have is a <type>.offsetof(<datamember>) property for
or union types. In C/C++ the preprocessor is used for this purpose, for
(from windows): #define FIELD_OFFSET(type, field) ((ulong)(ulong*)&(((type
Is there currently a way to do this in D? Dan
Feb 24 2003
"Dan Liebgold" <Dan_member pathlink.com> wrote in message news:b3cluc$23e8$1 digitaldaemon.com...What I would like to have is a <type>.offsetof(<datamember>) property for
or union types. In C/C++ the preprocessor is used for this purpose, for
(from windows): #define FIELD_OFFSET(type, field) ((ulong)(ulong*)&(((type
Is there currently a way to do this in D?
Yes; tag.member.offset should do it. -Walter
Feb 24 2003









"Achilleas Margaritis" <axilmar in.gr> 