D - Feature request: <struct>.offsetof(<member>) property
-
Dan Liebgold
(6/6)
Feb 24 2003
What I would like to have is a
.offsetof( ) property fo... - Achilleas Margaritis (7/13) Feb 24 2003 Good idea. Maybe it can be done in an OO way as a static property:
- Walter (6/11) Feb 24 2003 struct
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 forstructor union types. In C/C++ the preprocessor is used for this purpose, forexample(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
"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 forstructor union types. In C/C++ the preprocessor is used for this purpose, forexample(from windows): #define FIELD_OFFSET(type, field) ((ulong)(ulong*)&(((type*)0)->field))Is there currently a way to do this in D?Yes; tag.member.offset should do it. -Walter
Feb 24 2003