• 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: How to debug a corrupted stack
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to debug a corrupted stack


  • Subject: Re: How to debug a corrupted stack
  • From: Johannes Fortmann <email@hidden>
  • Date: Thu, 7 Aug 2008 18:55:40 +0200

The problem here is that UTCDateTime is defined with #pragma pack 2 in effect. That means the compiler packs with an alignment of 2, so the whole structure has 8 bytes. The proper alignment (4) results in 12 bytes. Since there's nothing in the @encode'd information specifying the non-standard alignment, NSGetSizeAndAlignment (which NSValue probably uses internally) will return 12 bytes as the struct's size.

As an example,

#include <Foundation/Foundation.h>

void main()
{
NSUInteger size, align;
NSGetSizeAndAlignment (@encode(UTCDateTime),
&size,
&align);
printf("%i, %i, %s\n", sizeof(UTCDateTime), size, @encode(UTCDateTime));
}


prints "8, 12, {UTCDateTime=SIS}".

HTH,
Johannes Fortmann
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: NSBrowser redraw issues with multiple selection
  • Next by Date: Saving Outline View Column Widths
  • Previous by thread: Re: How to debug a corrupted stack
  • Next by thread: Re: How to debug a corrupted stack
  • Index(es):
    • Date
    • Thread