If I make two identical string constants (@"samestring" and @"samestring") in my Cocoa program, are their pointers guaranteed to be equal? I assumed this without thinking while prototyping root objects in an NSOutline view and it did work, however I just realized that perhaps I shouldn't rely on this behaviour.
The compiler documentation (http://developer.apple.com/documentation/developertools/gcc-4.0.1/gcc/Constant-string-objects.html) doesn't say either way. The CFString documentation (http://developer.apple.com/documentation/CoreFoundation/Conceptual/CFStrings/Articles/CreatingAndCopying.html) says about the CFSTR() macro: "If there are two or more exact instances of a constant string in an executable, in some cases only one might be stored." Which I'll take to mean that in some cases two or more might be stored. However, when I get to the documentation for the @"..." construct (http://developer.apple.com/documentation/Cocoa/Conceptual/Strings/Articles/CreatingStrings.html) it says "The compiler makes such object constants unique on a per-module basis...". So does that mean once I'm up at the Cocoa level, that constant strings *are* guaranteed to have the same pointer if their contents are the same? What is "unique" and what is a "module" in this context? thanks, -natevw ____________________________________________________________________________________ ¡Capacidad ilimitada de almacenamiento en tu correo! No te preocupes más por el espacio de tu cuenta con Correo Yahoo!: http://correo.espanol.yahoo.com/ _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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]