By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 909 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

pragma pack and inheritance

P: n/a
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
Mar 22 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
sorry wrong group. i posted to the evc forum. it's only happening when
targeting the ppc2003 sdk in vc 2005
Mar 22 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.