Thread overview
structs within unions bug ?
Jun 19, 2004
Charlie
Jun 19, 2004
Charlie
June 19, 2004
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
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
"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