![](/img/trans.png)
[英]undefined reference to `Static Class Member variable inside Static member function'
[英]Where does the local static variable inside static member function resides in memory?
static 成員 function 中的局部 static 變量在哪里? 例如:
class Foo
{
public:
static void Bar()
{
static int fooBar;
}
};
'fooBar' 在 memory 中的位置以及分配時間。
這顯然是特定於編譯器和平台的,但通常在 PC 上,它與全局變量位於相同的 memory 中。 它在第一次進入 function 時被初始化。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.