The easiest way to create a string object in your source code is to use the Objective-C @ "..." construct:
NSString *temp = @"/tmp/scratch";
Note that when creating a string constant in this way you must use UTF-8 characters. Such an object is created at compile time and exists at runtime of your programs. The compiler makes such object constants unique for each module, and theyre never freed, although you can save and free them like any other object. You can also send messages directly to the line constant, as in any other line:
BOOL same = [@"comparison" isEqualToString:myString];
this is a quote from Creating Strings in the ObjC documentation.
I tested another @ "" line in application A, as well as libB used by the application. All @ "" that are initialized using the string = @ "..." mode and have the same content, all point to the same memory address.
So I don't understand the meaning of "per-module basis", what does "per-module" mean? based on lib? is the application based? file based?
source share