Re: minor ARC casting question

2011-11-02 Thread Greg Parker
On Nov 2, 2011, at 8:43 AM, Matt Neuburg wrote: > And, since Apple's own example, with no casting, does not compile, I was left > with *no* official documentation as to what I should do in those cases. Did you file a bug report? -- Greg Parker gpar...@apple.com Runtime Wrangler

Re: minor ARC casting question

2011-11-02 Thread Igor Mozolevsky
On 2 November 2011 15:43, Matt Neuburg wrote: > What I wasn't understanding is why I *didn't* have to cast to __bridge id in > the first two cases I listed. That's easy: the compiler should have no problem tracking the use of ids throughout as they are easily managed (eg, an id can live inside

Re: minor ARC casting question

2011-11-02 Thread Matt Neuburg
On Nov 2, 2011, at 4:31 AM, Igor Mozolevsky wrote: > the compiler has > no clue what you intend to do with `ref' of type `CGImageRef'. What > bridging does is it tells the compiler to stop worrying because _you_ > have taken over the management of the type You're focussing on the wrong part of

Re: minor ARC casting question

2011-11-02 Thread Igor Mozolevsky
On 2 November 2011 00:06, Matt Neuburg wrote: > On Sun, 30 Oct 2011 15:55:39 +, Igor Mozolevsky > said: >>On 30 October 2011 15:15, Matt Neuburg wrote: >>> In ARC, this is legal: >>> >>> self.view.layer.contents = (id)[[UIImage imageNamed:@"boat.gif"] CGImage]; >>> >>> And this is legal: >>

Re: minor ARC casting question

2011-11-01 Thread David Duncan
On Nov 1, 2011, at 6:38 PM, Matt Neuburg wrote: > > On Nov 1, 2011, at 5:21 PM, David Duncan wrote: > >> This compiles for me under ARC: >> NSArray *array = [NSArray arrayWithObject:[[UIColor greenColor] CGColor]]; >> > > > Well, not for me. I get: "Implicit conversion of a non-Objective-C po

Re: minor ARC casting question

2011-11-01 Thread Greg Parker
On Nov 1, 2011, at 5:06 PM, Matt Neuburg wrote: >CAGradientLayer *gradientLayer = [CAGradientLayer layer]; >gradientLayer.colors = [NSArray arrayWithObjects:(id)[[UIColor > darkGrayColor] CGColor], >(id)[[UIColor lightGrayColor] CGColor], nil]; > > And now we'r

Re: minor ARC casting question

2011-11-01 Thread David Duncan
On Nov 1, 2011, at 5:06 PM, Matt Neuburg wrote: > Well, the example code there says: > >CAGradientLayer *gradientLayer = (CAGradientLayer *)[self layer]; >gradientLayer.colors = [NSArray arrayWithObjects:[[UIColor darkGrayColor] > CGColor], >

Re: minor ARC casting question

2011-11-01 Thread Matt Neuburg
On Sun, 30 Oct 2011 15:55:39 +, Igor Mozolevsky said: >On 30 October 2011 15:15, Matt Neuburg wrote: >> In ARC, this is legal: >> >> self.view.layer.contents = (id)[[UIImage imageNamed:@"boat.gif"] CGImage]; >> >> And this is legal: >> >> id ref = (id)[[UIImage imageNamed:@"boat.gif"] CGImag

Re: minor ARC casting question

2011-10-30 Thread Igor Mozolevsky
On 30 October 2011 16:05, Matt Neuburg wrote: > On Sun, 30 Oct 2011 08:46:02 -0700, Kyle Sluder said: >>On Oct 30, 2011, at 8:15 AM, Matt Neuburg wrote: >> >>> And this is legal: >>> >>>    id ref = (id)[[UIImage imageNamed:@"boat.gif"] CGImage]; >>>    self.view.layer.contents = ref; >> >>It's

Re: minor ARC casting question

2011-10-30 Thread Matt Neuburg
On Sun, 30 Oct 2011 08:46:02 -0700, Kyle Sluder said: >On Oct 30, 2011, at 8:15 AM, Matt Neuburg wrote: > >> And this is legal: >> >>id ref = (id)[[UIImage imageNamed:@"boat.gif"] CGImage]; >>self.view.layer.contents = ref; > >It's my understanding that this shouldn't compile under ARC.

Re: minor ARC casting question

2011-10-30 Thread Igor Mozolevsky
On 30 October 2011 15:15, Matt Neuburg wrote: > In ARC, this is legal: > >    self.view.layer.contents = (id)[[UIImage imageNamed:@"boat.gif"] CGImage]; > > And this is legal: > >    id ref = (id)[[UIImage imageNamed:@"boat.gif"] CGImage]; >    self.view.layer.contents = ref; > > But this is not:

Re: minor ARC casting question

2011-10-30 Thread Kyle Sluder
On Oct 30, 2011, at 8:15 AM, Matt Neuburg wrote: > And this is legal: > >id ref = (id)[[UIImage imageNamed:@"boat.gif"] CGImage]; >self.view.layer.contents = ref; It's my understanding that this shouldn't compile under ARC. You should be required to perform a bridged cast when assignin