Thread overview | |||||
---|---|---|---|---|---|
|
June 19, 2004 structs within unions bug ? | ||||
---|---|---|---|---|
| ||||
import win32.ansi.windows; struct EventArgs { union { struct TextSelectionArgs{ int selIndex; char [] selText; }; struct IndexSelectionArgs { int selIndex; int subSelIndex; }; struct CoordinateArgs { int xPos; int yPos; int vKey; }; } static EventArgs create(WPARAM w, LPARAM l ) { EventArgs x; x.wparam = w; x.lparam = l; return x; } WPARAM wparam; LPARAM lparam; } int main () { EventArgs args; args.CoordinateArgs.xPos = 21; args.CoordinateArgs.yPos = 21; return 1; } $dmd foo.d -I/dmd/include foo.d(44): no property 'CoordinateArgs' for type 'EventArgs' Im not sure if this a bug or not, should I be able to do this ? Charlie |
June 19, 2004 Re: structs within unions bug ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Charlie | Here it is in readable format http://www.noidea128.org/cgi-bin/framesource.cgi?id=5649&type=html C In article <cb07es$o5s$1@digitaldaemon.com>, Charlie says... > >import win32.ansi.windows; > > >struct EventArgs >{ >union >{ >struct TextSelectionArgs{ >int selIndex; >char [] selText; >}; > >struct IndexSelectionArgs { >int selIndex; >int subSelIndex; >}; > >struct CoordinateArgs { >int xPos; >int yPos; >int vKey; >}; > >} > >static EventArgs create(WPARAM w, LPARAM l ) >{ >EventArgs x; >x.wparam = w; >x.lparam = l; > >return x; >} > >WPARAM wparam; >LPARAM lparam; > >} > >int main () { > >EventArgs args; >args.CoordinateArgs.xPos = 21; >args.CoordinateArgs.yPos = 21; > >return 1; > > >} > > >$dmd foo.d -I/dmd/include >foo.d(44): no property 'CoordinateArgs' for type 'EventArgs' > > > >Im not sure if this a bug or not, should I be able to do this ? > >Charlie > > |
June 20, 2004 Re: structs within unions bug ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Charlie | "Charlie" <Charlie_member@pathlink.com> escribió en el mensaje news:cb07es$o5s$1@digitaldaemon.com | | [code] | Change EventArgs to: struct TextSelectionArgs{ int selIndex; char [] selText; }; struct IndexSelectionArgs { int selIndex; int subSelIndex; }; struct CoordinateArgs { int xPos; int yPos; int vKey; }; struct EventArgs { union { TextSelectionArgs text; IndexSelectionArgs index; CoordinateArgs coor; } static EventArgs create(WPARAM w, LPARAM l ) { EventArgs x; x.wparam = w; x.lparam = l; return x; } WPARAM wparam; LPARAM lparam; } | Im not sure if this a bug or not, should I be able to do this ? | | Charlie I think that's the expected behavior. ----------------------- Carlos Santander Bernal |
Copyright © 1999-2021 by the D Language Foundation