Re: Using CFSTR() with const char * variable

2015-06-07 Thread Jean-Daniel Dupas
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

Re: Using CFSTR() with const char * variable

2015-06-06 Thread Steve Christensen
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__ #

Re: Using CFSTR() with const char * variable

2015-06-05 Thread dangerwillrobinsondanger
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'

Re: Using CFSTR() with const char * variable

2015-06-05 Thread Carl Hoefs
> 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

Re: Using CFSTR() with const char * variable

2015-06-05 Thread Ken Thomases
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";

Re: Using CFSTR() with const char * variable

2015-06-05 Thread Roland King
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

Using CFSTR() with const char * variable

2015-06-05 Thread Carl Hoefs
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 );