• 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: Arcs and Bridges
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Arcs and Bridges


  • Subject: Re: Arcs and Bridges
  • From: David Duncan <email@hidden>
  • Date: Mon, 17 Oct 2011 09:55:11 -0700

On Oct 15, 2011, at 11:42 PM, Quincey Morris wrote:

> Use '(__bridge_transfer NSString *)'. You're transferring ownership via 'axb' to ownership via 'myString', if that makes any sense.
>
> ARC uses horribly ambiguous terminology here:

This is one of the reasons we added the CFBridgingRetain and CFBridgingRelease functions to wrap the typecasts.

You use CFBridgingRetain to convert an object that is managed via ARC to one that is managed manually, and CFBridgingRelease to do the opposite.

So you write "CFStringRef cfString = CFBridgingRetain(nsString)" to get an owning reference to an NSString as a CFString.
And you write "NSString *nsString = CFBridgingRelease(cfString);" to get an ARC managed reference of a CFString as an NSString.
--
David Duncan

_______________________________________________

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: 
 >Arcs and Bridges (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: Arcs and Bridges (From: Quincey Morris <email@hidden>)

  • Prev by Date: Zooming a view, that is contained in an NSScrollView
  • Next by Date: Re: Arc and performSelector
  • Previous by thread: Re: Arcs and Bridges
  • Next by thread: Arc and performSelector
  • Index(es):
    • Date
    • Thread