That’s not going to work.
__builtin___CFStringMakeConstantString is a special compiler function that
requires a constant string to work in the first place, as it tells the compiler
to generate CFString literal.
I doubt the compiler will accept anything else as parameter.
> Le 7 juin 2015 à 03
In my prefix file that is used to build precompiled headers, I include the
following after #import-ing all the framework headers. It replaces the standard
definition with a version that doesn't insert quotes around an unquoted string
literal.
#undef CFSTR//(cStr)
#ifdef __CONSTANT_CFSTRINGS__
#
Sent from my iPhone
> On 2015/06/06, at 13:12, Carl Hoefs wrote:
>
> Okay, got it. (BTW, it’s probably just me, but the entire set of CF*
> functions seems to be a bit oddly designed, no?)
They might seem so at first but they're pretty clever and well designed as an
Object Oriented C.
They'
> On Jun 5, 2015, at 8:17 PM, Ken Thomases wrote:
>
> On Jun 5, 2015, at 10:02 PM, Carl Hoefs
> wrote:
>
>> If I use CFSTR() in the following way:
>> CFStringRef mystr = CFSTR( "This is a string" );
>> there is no problem.
>>
>> However, if I use a variable instead of “string” Xcode flags
On Jun 5, 2015, at 10:02 PM, Carl Hoefs wrote:
> If I use CFSTR() in the following way:
>CFStringRef mystr = CFSTR( "This is a string" );
> there is no problem.
>
> However, if I use a variable instead of “string” Xcode flags this as an error:
>const char *mystring = "This is a string";
CFSTR() documentation …
cStr
A constant C string (that is, text enclosed in double-quotation marks) from
which the string is to be created.
so no. If you look to see how that macro expands you can see why.
> On 6 Jun 2015, at 11:02, Carl Hoefs wrote:
>
> If I use CFSTR() in the following
If I use CFSTR() in the following way:
CFStringRef mystr = CFSTR( "This is a string" );
there is no problem.
However, if I use a variable instead of “string” Xcode flags this as an error:
const char *mystring = "This is a string";
CFStringRef mystr = CFSTR( mystring );