NSString and NSCopying Protocol
NSString and NSCopying Protocol
- Subject: NSString and NSCopying Protocol
- From: Starman <email@hidden>
- Date: Tue, 19 Nov 2002 16:13:53 +0100
Hi everyone !
I just saw that NSString doesn't conform to NSCopying Protocol.
Theorically, the documentation of the protocol says : "The exact
meaning of \"copy\" can vary from class to class, but a copy must be a
functionally independent object with values identical to the original
at the time the copy was made."
So, I understand that a copy of a NSString gives me a new instance of
the object. But in fact, I get the same object (same memory address),
with retainCount incremented by one.
you can find a small tool to check what I say at the following url :
http://ixqdev.online.fr/BetaPBX/testString.tgz
I think it could be something optimized, since you gain memory space
and computing time, but can we say that NSString conforms to NSCopying
Protocol ? It has not the behaviour a developer will expect....
Am I correct ?
Starman
_______________________________________________
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.