[futurebasic] Re: [FB] ABEmailForName

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : July 2010 : Group Archive : Group : All Groups

From: Robert Purves <listrp@...>
Date: Sun, 11 Jul 2010 00:18:47 +1200
Bernie wrote:

> not sure why gcc throws up an 'incompatible pointer type' warning if I omit the '(CFStringRef)' cast before kABEmailHomeLabel.

> // ABGlobalsC.h
> system CFStringRef kABEmailHomeLabel

> fn HIViewSetText( sConsoleHITextView, fn EmailForName( @"Ron", @"Barrow", (CFStringRef)kABEmailHomeLabel ) )

It's true that ABGlobalsC.h declares a CFStringRef:
   extern CFStringRef const kABEmailHomeLabel;  // Home email
But when you compile everything as Objective-C you pick up the other personality of kABEmailHomeLabel, in ABGlobals.h
    extern NSString * const kABEmailHomeLabel;  // Home email
The cast is then necessary to pacify the compiler.

It wouldn't happen if you split off your Obj-C code into its own *.m and *.h files, and turned off the 'Compile as Objective-C' checkbox.

Robert P.