Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 27, 2007, 5:49:03 AM (16 years ago)
Author:
landauf
Message:

hopefully replaced all static pre-main variables with more secure wrapper functions. and now i'll sleep.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/FICN/src/orxonox/core/Identifier.cc

    r696 r698  
    3838    // ###       Identifier        ###
    3939    // ###############################
    40     int Identifier::hierarchyCreatingCounter_s = 0; // Set the static member variable hierarchyCreatingCounter_s to zero
    41     unsigned int Identifier::classIDcounter_s = 0;  // Set the static member variable classIDcounter_s to zero
     40    int Identifier::hierarchyCreatingCounter_s = 0; // Set the static member variable hierarchyCreatingCounter_s to zero (this static member variable is ok: it's used in main(), not before)
    4241
    4342    /**
     
    5049
    5150        this->children_ = new IdentifierList;
    52         this->classID_ = Identifier::classIDcounter_s++;
     51
     52        // Use a static variable because the classID gets created before main() and that's why we should avoid static member variables
     53        static unsigned int classIDcounter_s = 0;
     54        this->classID_ = classIDcounter_s++;
    5355    }
    5456
Note: See TracChangeset for help on using the changeset viewer.