Re: C++ class member alignment in Xcode
Re: C++ class member alignment in Xcode
- Subject: Re: C++ class member alignment in Xcode
- From: John Daniel <email@hidden>
- Date: Thu, 8 Feb 2007 17:13:00 -0600
Could you post some runnable code that demonstrates this problem. I
can't repeat your results.
John
On Feb 8, 2007, at 1:05 PM, <email@hidden> wrote:
Hello,
I am having a problem with a derived class accessing members in the
base
class. It looks like this:
In file CClassA.cpp
class classA
{
public:
short mem1;
long mem2;
Boolean mem3;
Boolean mem4;
Boolean mem5;
Boolean mem6;
Boolean mem7;
Handle mem8;
};
In file CClassB.cpp
class classB : public classA
{
UInt32 mem9;
};
If I reference mem8 from classA everything works fine. When I try to
use the handle mem8 from classB I crash. Upon investigation classB
has
a different offset for mem8 then classA has. ClassA is aligning
members
on a 4-byte boundary while classB is aligning on a 2-byte boundary. I
can not find any file level properties for member alignment.
I have preformed a clean rebuild of the project and get the same
result.
Why does one file use 4-byte alignment while another on in the same
project uses 2-byte?
Regards,
Ron Lingl
Interactive Solutions, Inc.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40etresoft.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden