Uninitalized variable
I have heard a lot about initializing variables and have wondered why so much is being said about it as long as the developer is going to use the variable sensibly, but i happened to work on a issue where a uninitialized variable (supposed to hold a proper enum value) was passed on to a function working on the following enum values, ----------------------------------------------------------------------------------------------------------------- [Code] enum property { NAME = 0, TELEPHONE, ADDRESS, E-MAIL, FAX, PAGER }; void act_on_property(int property_type) { switch(property_type) { case NAME : ... case TELEPHONE : ... case ADDRESS : ... case E-MAIL : ... case FAX : ... case PAGER : ... default : log ("invalid value"); } } ----------------------------------------------------------------------------------------------------------------- The problem was that the variable was a global one, having static storage class. In one p...