• 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: Storing a block in a CF/NSMutableDictionary?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Storing a block in a CF/NSMutableDictionary?


  • Subject: Re: Storing a block in a CF/NSMutableDictionary?
  • From: Fritz Anderson <email@hidden>
  • Date: Mon, 11 Apr 2011 09:18:35 -0500

On 10 Apr 2011, at 11:39 AM, Ken Thomases wrote:

>> I am grateful you called this to my attention, as I had been thinking that blocks were closures, in which referencing (but not, usefully, changing) stack-local variables would work.
>
> Blocks are closures and referencing stack-local variables does work.  For non-__block variables, the block has a const copy of the value, just as though it were passed by value into a function.
>
>> I'd been thrown by the existence of the __block attribute, which permits referencing a stack-local variable as an lvalue. I had reasoned that if a __block variable _is_ obviously a reference to that memory, a non-__block variable (whose value does _not_ propagate to the stack variable when a block changes it) obviously _couldn't_ be a reference.
>
> You had been correct.  Kyle just confused you.

Your response is very clear, and my mind is at ease. Thank you.

	— F

_______________________________________________

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: 
 >Storing a block in a CF/NSMutableDictionary? (From: Rick Mann <email@hidden>)
 >Re: Storing a block in a CF/NSMutableDictionary? (From: Kyle Sluder <email@hidden>)
 >Re: Storing a block in a CF/NSMutableDictionary? (From: Fritz Anderson <email@hidden>)
 >Re: Storing a block in a CF/NSMutableDictionary? (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: bitmapData leak
  • Next by Date: Re: blocks and NSInvocation question
  • Previous by thread: Re: Storing a block in a CF/NSMutableDictionary?
  • Next by thread: Controller Selection Synchronization
  • Index(es):
    • Date
    • Thread