> On Dec 4, 2017, at 16:14 , Greg Parker <[email protected]> wrote: > > >> On Dec 4, 2017, at 3:22 PM, Rick Mann <[email protected]> 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.
Yeah, I figured as much. In this case, that's okay. I was just trying to declutter the call site. Thanks! -- Rick Mann [email protected] _______________________________________________ Cocoa-dev mailing list ([email protected]) 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 [email protected]
