Re: autorelease CGImageRef?
Re: autorelease CGImageRef?
- Subject: Re: autorelease CGImageRef?
- From: "Sean McBride" <email@hidden>
- Date: Thu, 7 Aug 2008 10:17:21 -0400
- Organization: Rogue Research
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@hidden
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden