The following code is problematic: // at file scope - global variable const_val< long> MAX_USERS( get_prop( "max_users") ); AllUsers::AllUsers() { // here, we cannot be sure that MAX_USERS has been initialized std::cout << "there are max " << MAX_USERS << " users that can login." << std::endl; } However, the following code is not problematic AllUsers::AllUsers() { // local variable const long MAX_USERS( get_prop( "max_users") ); // here, MAX_USERS is initialized std::cout << "there are max " << MAX_USERS << " users that can login." << std::endl; } |