"Need 'this' to access structure member"

alxdef alxdef_member at pathlink.com
Thu Jun 22 22:59:50 PDT 2006


Hi there!
I am beginner in D and I confused with subject.
Here my source:

Module some_mod.d ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
module some_mod;
struct struct1
{
union addr
{
struct
{
ushort offs;
ushort seg;
}
uint flat;
};
};
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In main.d ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
import some_mod;
struct1 s;
s.addr.flat = 0;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Compile command: DMD main.d some_mod.d

At this point compiler says the subject message. When I make 'offs', 'seg', and
'flat' as static compilation is well, but it is not what I need, cause fields of
union is unmodifiable. Could someone help with this?
Thanks a lot!

Sorry for my English!



More information about the Digitalmars-d mailing list