no warning when assigning a string to itself; infinite loop when printing a string

Steve Ward planet36@gmail.com
Sun May 22 23:36:00 GMT 2011


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc_no_warning.cpp
Type: text/x-c++src
Size: 462 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20110522/7b2438d0/attachment.bin>


More information about the Gcc-help mailing list