Compilerwarnung (Stufe 3) C4640

Aktualisiert: November 2007

Fehlermeldung

'Instanz': Erstellen eines lokalen static-Objekts ist nicht threadsicher
'instance' : construction of local static object is not thread-safe

Eine statische Instanz eines Objekts ist nicht threadsicher.

Diese Warnung ist standardmäßig deaktiviert. Weitere Informationen finden Sie unter Standardmäßig deaktivierte Compilerwarnungen.

Im folgenden Beispiel wird C4640 generiert:

// C4640.cpp
// compile with: /W3
#pragma warning(default:4640)

class X {
public:
   X() {
   }
};

void f() {
   static X aX;   // C4640
}

int main() {
   f();
}