Is there a difference between a global and a static global?
In Objective C (if that matters) is there a difference between these two state开发者_如何学JAVAments? And if so, what?
Statement 1:
std::map<id, id> foo;
Statement 2:
static std::map<id, id> sFoo;
Note that these are both globals that would be declared in the .mm at file scope.
static, in this context, means that the variable is visible only within the current file, but is visible everywhere in that file. So no: a true global variable would be visible everywhere.
加载中,请稍侯......
精彩评论