Re: static acting like __block in GCD singleton pattern
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