Re: Storing a block in a CF/NSMutableDictionary?
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