Re: Block Behavior
Re: Block Behavior
- Subject: Re: Block Behavior
- From: koko <email@hidden>
- Date: Thu, 16 Feb 2012 10:46:32 -0700
Ok. I need to read up on blocks … I was pushed to this because of using
beginSheetModalForWindow:completionHandler:
the __block prefix solved the problem.
Thanks.
-koko
On Feb 15, 2012, at 11:00 PM, Jens Alfke wrote:
>
> On Feb 15, 2012, at 4:41 PM, koko wrote:
>
>> Candidate function not viable: 'this' argument has type 'const BPreferences', but method is not marked const
>
> Blocks can’t modify variables in the enclosing scope unless the variables are marked ‘__block’. In C++ code, I suppose that extends to interpreting those variables as ‘const’, which makes sense, otherwise you could call a method from the block that could mutate the variable.
>
> If ‘prefs’ is a local variable, try prefixing the declaration with ‘__block’.
>
> —Jens
_______________________________________________
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