Re: Is @"constantstring" pointer equal to @"constantstring" a guarantee?

2008-03-27 Thread Kyle Sluder
On Thu, Mar 27, 2008 at 10:52 PM, glenn andreas <[EMAIL PROTECTED]> wrote: > Bad Idea. > > Consider that, at some point, you move your code into a framework that > you can reuse in multiple projects. While the linker can coalesce > constant strings within a single binary, it obviously doesn't

Re: Is @"constantstring" pointer equal to @"constantstring" a guarantee?

2008-03-27 Thread glenn andreas
On Mar 27, 2008, at 9:41 PM, Kyle Sluder wrote: On Thu, Mar 27, 2008 at 9:16 PM, Jens Alfke <[EMAIL PROTECTED]> wrote: The linker coalesces multiple identical string constants into a single value in the data segment. However, you can still end up with multiple copies if your code was link

Re: Is @"constantstring" pointer equal to @"constantstring" a guarantee?

2008-03-27 Thread Ken Thomases
On Mar 27, 2008, at 9:41 PM, Kyle Sluder wrote: But it still makes sense to me that when I'm providing NSString constants to be used as they are in the case of an NSError's userInfo dictionary, for example, that pointer comparison is still valid. Of course I wouldn't do it for places where I ex

Re: Is @"constantstring" pointer equal to @"constantstring" a guarantee?

2008-03-27 Thread Kyle Sluder
On Thu, Mar 27, 2008 at 9:16 PM, Jens Alfke <[EMAIL PROTECTED]> wrote: > The linker coalesces multiple identical string constants into a single > value in the data segment. However, you can still end up with multiple > copies if your code was linked in separate pieces and then joined > together

Re: Is @"constantstring" pointer equal to @"constantstring" a guarantee?

2008-03-27 Thread Jens Alfke
On 27 Mar '08, at 4:20 PM, Nathan Vander Wilt wrote: 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? The linker coalesces multiple identic

Re: Is @"constantstring" pointer equal to @"constantstring" a guarantee?

2008-03-27 Thread Bill Bumgarner
On Mar 27, 2008, at 4:20 PM, Nathan Vander Wilt wrote: 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? They might be unique, they might not.

Is @"constantstring" pointer equal to @"constantstring" a guarantee?

2008-03-27 Thread Nathan Vander Wilt
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 th