> On Dec 4, 2017, at 3:22 PM, Rick Mann <rm...@latencyzero.com> wrote: > > Ugh...been doing too much Swift (j/k). The right answer to this question is: > > @(kSomeCStringConstant) > > This works whether it's a #define or a static const char* const.
The downsides are: 1. If the library requires that you use the actual address stored in string variable kSomeCStringConstant then it may fail because @(kSomeCStringConstant) may create a second object at a different address. 2. The compiler is not currently smart enough to optimize @(kSomeCStringConstant) into a constant string object, so it may allocate a new autoreleased string object every time it runs that line. -- Greg Parker gpar...@apple.com Runtime Wrangler _______________________________________________ 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