Union member positions?

z z at z.com
Tue Aug 17 13:46:22 UTC 2021


Is it possible to set a "position" on a union member? or is there 
is a language-integrated equivalent?
For example, to get access to each byte in an unsigned integer 
while still supporting the original type.
```D
///a single uint that would be accessed as two ushort, or four 
separate ubyte
union UnionExample{
uint EAX;

//upper
ushort EAHX;

ubyte EAHH;
ubyte EAHL;

//lower
ushort EALX;

ubyte EALH;
ubyte EALL;
}
```
Thanks.


More information about the Digitalmars-d-learn mailing list