470,849 Members | 652 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,849 developers. It's quick & easy.

pragma pack and inheritance

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
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;

Why doesnt this work? I am running visual studio 2005 and am targeting
pocket pc 2003 SDK
Mar 22 '06 #1
1 1379
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.

Similar topics

1 post views Thread by JustSomeGuy | last post: by
6 posts views Thread by Shri | last post: by
9 posts views Thread by Giovanni Bajo | last post: by
15 posts views Thread by muttaa | last post: by
3 posts views Thread by Jimmy | last post: by
26 posts views Thread by Rick | last post: by
reply views Thread by debasisdas | last post: by
6 posts views Thread by Boltar | last post: by
4 posts views Thread by Steven Woody | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.