[fpc-devel]CFSTR, some C guru please

Jonas Maebe jonas at zeus.ugent.be
Mon Aug 16 13:18:09 CEST 2004


On 16 aug 2004, at 13:05, Olle Raab wrote:

> But I doesn't understand it completely :
>
> In the C headers, the macros is defined as follows:
>
> #define CFSTR(cStr) __CFStringMakeConstantString(cStr "")

In the CFString.h of the CoreFoundation framework it's defined as

#define CFSTR(cStr)  __CFStringMakeConstantString("" cStr "")

but that doesn't really matter.

"" is the same as '' in Pascal: it's an empty string. In C, to 
concatenate constant string, you don't put a "+" in between them, you 
just write them next to each other. So In Pascal that would be

__CFStringMakeConstantString('' + cStr + '');

This is probably to force some typecasting for certain ambiguous 
C-constructs. Pascal shouldn't need this.


Jonas





More information about the fpc-devel mailing list