• 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: Block Behavior
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Block Behavior (From: koko <email@hidden>)
 >Re: Block Behavior (From: Greg Parker <email@hidden>)
 >Re: Block Behavior (From: koko <email@hidden>)

  • Prev by Date: Re: receptionist pattern question: NSOperationQueue vs. GCD
  • Next by Date: standard user or admin user ?
  • Previous by thread: Re: Block Behavior
  • Next by thread: Re: Block Behavior
  • Index(es):
    • Date
    • Thread