On Jul 26, 2009, at 3:04 PM, Kyle Sluder wrote:

On Jul 26, 2009, at 2:52 PM, "Adam R. Maxwell" <[email protected]> wrote:

"CFString objects perform other “tricks” to conserve memory, such as incrementing the reference count when a CFString is copied."

Not every NSString is necessarily a CFString. They're toll-free bridged, but that just means the CF implementation needs to be aware of any non-NSCFString instances it is handed. I belive the private NSPathStorage class might not be a subclass of NSCFString.

Correct. The same design principle applies for NS classes, though, and a quick test program shows that -[NSPathStore2 copy] returns the same pointer.

IOW, just because two types are toll-free bridged does not mean they have the same behavior. Look at NSDictionary for a known example; if you create a CFDictionary with certain options and then use it as an NSDictionary you do not get the same behavior (I believe the relevant option involves whether the dictionary should copy its keys).

Yeah, that's part of it. If you use pointer equality and copyWithZone: doesn't return the same object, setObject:forKey: will break your dictionary.

http://www.cocoabuilder.com/archive/message/cocoa/2006/6/9/165304

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to