Re: Problem with "warning: deprecated conversion from string constant to ‘char*’"
Marc Glisse
marc.glisse@inria.fr
Tue Oct 12 16:49:00 GMT 2010
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
More information about the Gcc-help
mailing list