Re: when __bridge isn't required

2013-07-28 Thread Charles Srstka
On Jul 27, 2013, at 2:05 PM, Zac Bowling wrote: > The first one is a NSConstantString string. It's not like a malloc'd > NSString. It's effectively a singleton. It doesn't mater how it's bridged > because it can't be released. The second is a new NSURL that is allocated on > the heap. It needs

Re: when __bridge isn't required

2013-07-27 Thread Matt Neuburg
Argh. Okay, I'll ask this on devforums when it comes back up, in case it depends on, uh, the thing I'm using that I can't talk about. m. On Jul 27, 2013, at 12:10 PM, Quincey Morris wrote: > I tried both your examples in Xcode 4.6.3 and OS X 10.8 SDK, and neither > produced an error or a warn

Re: when __bridge isn't required

2013-07-27 Thread Quincey Morris
On Jul 27, 2013, at 11:54 , Robert Martin wrote: > But CGImageSourceCreateWithURL() includes the keyword 'create' - so the > object you get back has a retain count of 1. ARC will insist that you cast > with __bridge or __bridge_transfer. ARC isn't involved with the return value in either case.

Re: when __bridge isn't required

2013-07-27 Thread Zac Bowling
The first one is a NSConstantString string. It's not like a malloc'd NSString. It's effectively a singleton. It doesn't mater how it's bridged because it can't be released. The second is a new NSURL that is allocated on the heap. It needs to be released so it needs to be bridged correctly to han

Re: when __bridge isn't required

2013-07-27 Thread Tom Davie
The first gives me the following error: Implicit conversion of Objective-C pointer type 'NSString *' to C pointer type 'CFStringRef' (aka 'const struct __CFString *') requires a bridged cast Tom Davie On Jul 27, 2013, at 8:31 PM, Matt Neuburg wrote: > I feel like I've asked this before, but I

Re: when __bridge isn't required

2013-07-27 Thread Robert Martin
My take: __bridge means 'do not transfer the retain count of to the LHS'. If the RHS involves some kind of create or new, then you'll get a leak since ARC won't release it. __bridge_transfer means 'transfer the retain count of to the LHS'. If the RHS involves some kind of create or new, then