I was wondering if there is much difference between:

NSString* kMyKey = @"aKey";

// and then throughout the application:
[myDictionary setObject:xxx forKey:kMyKey];
[myDictionary objectForKey: kMyKey];



vs

#define MYKEY @"aKey"

// and then throughout the application:
[myDictionary setObject:xxx forKey: MYKEY];
[myDictionary objectForKey: MYKEY];


The docs say the strings created with the @ construct are created at compile time. Does that mean potentially if we use the define 50 times, there are 50 NSStrings with identical content created at compile time? Or does the compiler optimize that as well?




_______________________________________________

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 arch...@mail-archive.com

Reply via email to