Re: Problem with "warning: deprecated conversion from string constant to ʽchar*ʼ"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 12 Oct 2010, Ian Lance Taylor wrote:

I'm not sure what you want us to suggest.  You say that the names are
modifiable.  String constants are not modifiable.  If the strings are
indeed modified, and you pass in a string constant, then your program is
going to crash when the library tries to modify the strings.  The gcc
warning is helpfully pointing that out.

This is not a gcc issue.  It's a C++ language issue.  If you need a
modifiable string, then you must not use a string constant.

I am not sure what the OP is asking for, but note that some other compilers provide an option (-features=no%conststrings for sunCC) to handle such broken legacy code without modification.

--
Marc Glisse


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux