[Adium-devl] [Adium-svn] rev 23724 - trunk/Plugins/Facebook Service

Graham Booker gbooker at cod3r.com
Thu May 29 16:19:58 UTC 2008


On May 29, 2008, at 9:57 AM, Peter Hosey wrote:

> On May 29, 2008, at 07:33:13, Evan Schoenberg wrote:
>> Does a constant string have a type like '[id]'?
>
> I don't know. I would think that it's NSConstantString *. I tried to
> check using the preprocessor's # operator and GCC's __typeof__
> operator, but got only my __typeof__ expression back.
>
> #define STR(x) #x
> 	NSLog(@"Type of @\"%@\": %s", @"foo", STR(__typeof__(@"foo")));
>
> 2008-05-29 07:55:51.554 typeof-constantstring[2547:10b] Type of
> @"foo": __typeof__(@"foo")
>
> C never has been known for its introspection capabilities. ☹

It is an NSConstantString *, iirc.  I've discovered this by  
accidentally releasing one (without a retain) and then using it later,  
getting interesting crashes.  You can stick constant @"" strings in  
dictionaries, and other containers just fine.  In addition, you can do  
things like:

[@"Some String" stringByAppendingString:otherString];

Also:

(gdb) po [@"SomeStr" class]
NSCFString

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3632 bytes
Desc: not available
URL: <http://adium.im/pipermail/devel_adium.im/attachments/20080529/f3d0b734/attachment.p7s>


More information about the devel mailing list