In the attached code, the line "const string str = str;" doesn't give a warning. Is this right? If I change the data type to an "int", a warning is given. ("warning: 'str' is used uninitialized in this function") Also, when trying to print the string, it seems to execute forever. Thanks, Steve
/* $ g++ --version g++ (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2 Copyright (C) 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ g++ -Wall gcc_no_warning.cpp && ./a.out */ #include <iostream> using namespace std; int main() { // no warning const string str = str; // infinite loop cout << str << endl; return 0; }