• 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: minor ARC casting question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: minor ARC casting question


  • Subject: Re: minor ARC casting question
  • From: Igor Mozolevsky <email@hidden>
  • Date: Sun, 30 Oct 2011 16:12:59 +0000

On 30 October 2011 16:05, Matt Neuburg <email@hidden> wrote:
> On Sun, 30 Oct 2011 08:46:02 -0700, Kyle Sluder <email@hidden> said:
>>On Oct 30, 2011, at 8:15 AM, Matt Neuburg <email@hidden> 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.
>
> Well, it does. Try it... It surprised me too.
>
> Of course that could be a bug. And in that case the third case is also a bug, since we're casting to id and assigning to something typed as id (layer.contents).
>
> But anyhow, that's exactly my question.


It is entirely plausible that after CSE that becomes just

self.view.layer.contents = (id)[[UIImage imageNamed:@"boat.gif"] CGImage];

So, in effect you're not doing anything "funky" that would confuse
compiler's ARC. In the latter case, you are actually doing "funky"
stuff and the compiler can't work out your "intentions"...



Cheers,

--
Igor
_______________________________________________

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: minor ARC casting question (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re: NSAssert no longer displaying reason in console
  • Next by Date: Re: NSAssert no longer displaying reason in console
  • Previous by thread: Re: minor ARC casting question
  • Next by thread: Versions and project editor app
  • Index(es):
    • Date
    • Thread