• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: C++ class member alignment in Xcode
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >C++ class member alignment in Xcode (From: <email@hidden>)

  • Prev by Date: Re: Copy files build phase for folders?
  • Next by Date: Re: Strange behavior in XCode, not exhibited in Dev-C++
  • Previous by thread: Re: C++ class member alignment in Xcode
  • Next by thread: Copy files build phase for folders?
  • Index(es):
    • Date
    • Thread