• 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: Unclear on -initWithBytesNoCopy:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unclear on -initWithBytesNoCopy:


  • Subject: Re: Unclear on -initWithBytesNoCopy:
  • From: Wade Tregaskis <email@hidden>
  • Date: Mon, 05 Mar 2012 16:40:45 -0800

Perhaps the only 'correct' solution to this problem is to fall back to the CFString level, where you can pass a custom CFAllocator to e.g. CFStringCreateWithBytesNoCopy().  That way the lifetime is effectively managed by the CFString, so it should behave correctly in all cases.

'course, the implementation is relatively awkard compared to what *should* be a single method call.  Perhaps a variant of initWithBytesNoCopy:, one that takes a block with which to free the bytes, should be created.
_______________________________________________

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


  • Follow-Ups:
    • Re: Unclear on -initWithBytesNoCopy:
      • From: Charles Srstka <email@hidden>
References: 
 >Unclear on -initWithBytesNoCopy: (From: Jens Alfke <email@hidden>)
 >Re: Unclear on -initWithBytesNoCopy: (From: Eli Bach2 <email@hidden>)

  • Prev by Date: Re: How are views supposed to reload after being nillified by memory warnings?
  • Next by Date: Re: notAKeyMarker crash
  • Previous by thread: Re: Unclear on -initWithBytesNoCopy:
  • Next by thread: Re: Unclear on -initWithBytesNoCopy:
  • Index(es):
    • Date
    • Thread