Are there any performance implications that would suggest preferring one or the 
other of these different styles?

NSString *s = @"sing me a song";
[myClass aMethod: s];

and

[myClass aMethod: @"sing me a song"];

I have a lot of the first kind in my code, and I'm thinking of simplifying it 
by turning them all into the second kind. A discussion on stackoverflow here:

http://stackoverflow.com/questions/25746/whats-the-difference-between-a-string-constant-and-a-string-literal

seems to suggest (if I've understood it correctly) that I'd be better off 
sticking with the first style to avoid errors and to speed up comparisons. 
However, since in my code they're all one-off 'throw away" strings that don't 
get used elsewhere, that doesn't seem relevant. Is there any other reason why I 
should stick with the first style rather than the second?


Thanks for your thoughts.

P

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to