• 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: encoding structs (NSCoder / NSArchiver issue)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: encoding structs (NSCoder / NSArchiver issue)


  • Subject: Re: encoding structs (NSCoder / NSArchiver issue)
  • From: "M. Uli Kusterer" <email@hidden>
  • Date: Mon, 19 Jan 2004 13:28:38 +0100

At 1:01 Uhr -0500 19.01.2004, Justin Anderson wrote:
Those are of static size and don't contain pointers, so they should get allocated in contiguous blocks. I *think* it's just a matter of typing [NSData dataWithBytes:aPlaneStruct length:sizeof(planeStruct)] for each planeStruct.

And if your array of structs isn't malloc'd in pieces, you could grab each array at once instead of individually.

Wouldn't that cause problems with alignment? If this NSData was loaded on a platform or with a compiler that aligns structs differently, you'd have to be careful to get them out intact.

Admitted, that issue might be unimportant if you're only deploying on Mac (which the majority of us are), but it'd probably be more future-safe if you encoded the components of your structs and arrays separately.
--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: 
 >encoding structs (NSCoder / NSArchiver issue) (From: Aaron Boothello <email@hidden>)
 >Re: encoding structs (NSCoder / NSArchiver issue) (From: Justin Anderson <email@hidden>)

  • Prev by Date: Restart a download from the last byte
  • Next by Date: Re: Auto sizing of Text View depending on typed in text
  • Previous by thread: Re: encoding structs (NSCoder / NSArchiver issue)
  • Next by thread: Panther's Crash Reporter
  • Index(es):
    • Date
    • Thread