• 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: Wyatt Webb <email@hidden>
  • Date: Thu, 8 Feb 2007 11:39:04 -0800

It's funny that you should ask this. I just finished chasing down the very same kind of problem in our project earlier in the week.

There are two #pragmas that can change your struct alignment: "#pragma options align" or "#pragma pack". These are usually used in pairs so the packing is changed for known data structures. In our case, we were using "#pragma options align=..." and forgot to close it with "#pragma options align=reset" in a header file. Since this malformed header was included in many places, it had side-effects in each file that used it.

The compiler never complained, but I had a situation where sizeof ( myClass ) would return different sizes in different .cpp files.

So, I would be looking for #pragmas and making sure they were all closed properly.

	-Wyatt

On Feb 8, 2007, at 11:05 AM, <email@hidden> <email@hidden> wrote:


Hello,

I am having a problem with a derived class accessing members in the base
class. It looks like this:



[...]


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:
40inspiration.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: C++ class member alignment in Xcode
  • Next by Date: Copy files build phase for folders?
  • Previous by thread: C++ class member alignment in Xcode
  • Next by thread: Re: C++ class member alignment in Xcode
  • Index(es):
    • Date
    • Thread