Thread overview | |||||
---|---|---|---|---|---|
|
February 24, 2003 Feature request: <struct>.offsetof(<member>) property | ||||
---|---|---|---|---|
| ||||
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 |
February 24, 2003 Re: Feature request: <struct>.offsetof(<member>) property | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dan Liebgold | 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 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 > > |
February 24, 2003 Re: Feature request: <struct>.offsetof(<member>) property | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dan Liebgold | "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 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? Yes; tag.member.offset should do it. -Walter |
Copyright © 1999-2021 by the D Language Foundation