M
Mike Margerum
I seem to be running into an issue where I am deriving a new class from
a struct with a different alignemnt via the pragma pack
#pragma pack(1)
typedef struct
{
unsigned short a;
unsigned int b;
} MyBase;
#pragma pack()
class CDerived : public MyBase
{
public:
unsigned short c;
void SetData(unsigned int& u)
{
u = 123;
}
};
If i instantiate a CDerived class and call the SetData method with the b
attribute, i get a data abort in the debugger.
CDerived d;
d.SetData(b);
Why doesnt this work? I am running visual studio 2005 and am targeting
pocket pc 2003 SDK
a struct with a different alignemnt via the pragma pack
#pragma pack(1)
typedef struct
{
unsigned short a;
unsigned int b;
} MyBase;
#pragma pack()
class CDerived : public MyBase
{
public:
unsigned short c;
void SetData(unsigned int& u)
{
u = 123;
}
};
If i instantiate a CDerived class and call the SetData method with the b
attribute, i get a data abort in the debugger.
CDerived d;
d.SetData(b);
Why doesnt this work? I am running visual studio 2005 and am targeting
pocket pc 2003 SDK