Re: Unclear on -initWithBytesNoCopy:
Re: Unclear on -initWithBytesNoCopy:
- Subject: Re: Unclear on -initWithBytesNoCopy:
- From: Eli Bach2 <email@hidden>
- Date: Sat, 03 Mar 2012 14:03:38 -0700
On Mar 3, 2012, at 12:15 PM, Jens Alfke wrote:
> I filed a bug report* saying that this substring optimization shouldn’t be used if the source string uses an external buffer, just as it shouldn’t if the source string is mutable. They fixed it, but some people there argue that their original implementation was correct (even if not compatible with Apple’s.) I’m curious, so I’m asking here to see if anyone knows for sure what’s intended.
Well, you can argue that the substring can't just reference the original string and bump it's retaincount to make sure the underlying data stays around because the original string doesn't own the data buffer. For it to be 'correct', there would at least need to be some mechanism to notify the data buffer owner that another object was using it.
Eli
_______________________________________________
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