共用方式為


編譯器錯誤 C2480

'identifier' : 'thread' 僅適用於靜態範圍的數據項

備註

您無法將 thread 屬性與自動變數、非靜態數據成員、函式參數或函數宣告或定義搭配使用。

thread僅使用全域變數、靜態數據成員和局部靜態變數的屬性。

Example

下列範例會產生 C2480:

// C2480.cpp
// compile with: /c
__declspec( thread ) void func();   // C2480
__declspec( thread ) static int i;   // OK