• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: autorelease CGImageRef?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Re: autorelease CGImageRef? (From: Mike Abdullah <email@hidden>)
 >Re: autorelease CGImageRef? (From: Jean-Daniel Dupas <email@hidden>)
 >Re: autorelease CGImageRef? (From: Negm-Awad Amin <email@hidden>)
 >Re: autorelease CGImageRef? (From: "Shawn Erickson" <email@hidden>)
 >Re: autorelease CGImageRef? (From: Peter N Lewis <email@hidden>)

  • Prev by Date: Re: IKSlideshow Question
  • Next by Date: Re: autorelease CGImageRef?
  • Previous by thread: Re: autorelease CGImageRef?
  • Next by thread: Re: autorelease CGImageRef?
  • Index(es):
    • Date
    • Thread