• 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: static acting like __block in GCD singleton pattern
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: static acting like __block in GCD singleton pattern


  • Subject: Re: static acting like __block in GCD singleton pattern
  • From: Kyle Sluder <email@hidden>
  • Date: Fri, 28 Jun 2013 17:26:04 -0700

On Fri, Jun 28, 2013, at 05:17 PM, Matt Neuburg wrote:
> Why is the block permitted to assign to the variable sharedInstance
> outside the block? Evidently it is because "static" has an effect like
> "__block", in that it makes the variable outside the block assignable.
> But how, exactly? Is it some kind of side effect of being a local static?

Yeah, static storage doesn't need to be captured.

There's no difference between a local or global variable with static
storage other than the scopes in which the variable can be referred to.

Consult the blocks spec for more:
http://clang.llvm.org/docs/BlockLanguageSpec.html

--Kyle Sluder
_______________________________________________

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


  • Follow-Ups:
    • Re: static acting like __block in GCD singleton pattern
      • From: Matt Neuburg <email@hidden>
References: 
 >static acting like __block in GCD singleton pattern (From: Matt Neuburg <email@hidden>)

  • Prev by Date: static acting like __block in GCD singleton pattern
  • Next by Date: Re: Moving a textField from under keyboard
  • Previous by thread: static acting like __block in GCD singleton pattern
  • Next by thread: Re: static acting like __block in GCD singleton pattern
  • Index(es):
    • Date
    • Thread