3 ms·
Constant strings have always been interned. I don't think any others are, though I haven't looked into it in a while.
by chc 11y ago
Constant strings have always been interned. I don't think any others are, though I haven't looked into it in a while.
- mikeash 11y agoIt's not NSString, but it's interesting to note that Objective-C selectors are just interned strings. By interning them, they can be compared with a simple pointer comparison. Because they're just C strings, you can print a selector by casting it to char *. (But don't do this in production code, debugging only!)