On 8/7/08 10:44 AM, Peter N Lewis said:

>>[NSMakeCollectable(aCGImageRef) autorelease];
>
>This appears correct, except for the fact that, for reasons known
>only to Apple, although CFMakeCollectable is available in 10.4, the
>trivial NSMakeCollectable macro is available only in 10.5.

Yes, quite annoying.

>So expanding the NSMakeCollectable macro gives:
>
>return [(id)CFMakeCollectable(aCGImageRef) autorelease];

True, but that cast can cause warnings, and so having it in a system
header is nice.  If you can, use the NS version.  Consider:

--------
#import <Cocoa/Cocoa.h>

int main (void)
{
        CFStringRef foo = nil;
        
        [NSMakeCollectable(foo) autorelease];
        [(id)CFMakeCollectable(foo) autorelease]; //line 8

        return 0;
}
--------

$ gcc-4.2 -Wcast-qual /Users/sean/Desktop/test.m
/Users/sean/Desktop/test.m: In function 'main':
/Users/sean/Desktop/test.m:8: warning: cast discards qualifiers from
pointer target type

I suspect that's why the NS version was later added.

--
____________________________________________________________
Sean McBride, B. Eng                 [EMAIL PROTECTED]
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada


_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to