Anfangswerte bei static Variablen



  • Hi

    Haben statische Variablen einen Anfangswert bei der deklaration ?
    thx



  • [unsinn][/unsinn]

    Greetz, Swordfish



  • RTFM! f'`8k

    @Swordfish: Unsinn.

    Bye, TGGC (\-/ returns)



  • LifeTimeRunTime schrieb:

    Haben statische Variablen einen Anfangswert bei der deklaration ?

    Static Variablen werden bei ihrer Definition ohne explizite Initialisierung nullinitialisiert. Was das im Einzelnen bedeutet, definiert der Standard wie folgt:

    To zero-initialize an object of type T means:
    — if T is a scalar type (3.9), the object is set to the value of 0 (zero) converted to T;
    — if T is a non-union class type, each nonstatic data member and each base-class subobject is zeroinitialized;
    — if T is a union type, the object’s first named data member is zero-initialized;
    — if T is an array type, each element is zero-initialized;
    — if T is a reference type, no initialization is performed.


Log in to reply