This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: deprecated conversion from string constant to 'char *'


Ian Lance Taylor wrote:
"Timothy C Prince" <tprince@myrealbox.com> writes:

gcc built from last Saturday's post on gcc.gnu.org/pub/gcc/snapshots

I've seen remarks about that not being a reliable source for FSF gcc. If those aren't good to use, why not offer something better?

That is a reliable source for FSF gcc snapshots.


Of course snapshots are just that: a snapshot of the development in
progress.  They are not guaranteed to work.

We still can't help with you without a complete and exact description
of precisely what you are doing.

Ian


Ian,
The example you made up is good enough. As you can see from the follow-ups, replacing 'char *' by 'const char *' in your example, or (consistently throughout) in my own case, solve the problem. The question remains whether g++ should abort the compilation when the legacy source code is discovered. If it does abort, with no option to continue (as it does in my testing), should it be reported as Error rather than warning? Should g++ -m32 produce a diagnostic similar to g++ -m64?


In case it's of interest, I've investigated the following compilers:

g++ 4.2 x86-64 reports "deprecated conversion" (and aborts) when const is omitted

g++ 4.2 -m32 x86-64, and Windows 32-bit, fail on a bunch of libstdc++ problems relative to char * conversions, when const is omitted

Intel icpc 9.1 linux x86-64 doesn't care whether const is present, no warning available (consistent with g++ 4.0.2 as base installation)
Intel ICL 9.1 Windows x64 has STL problems when const is omitted (unable to verify whether that corresponds to behavior of base MSVC++ installation)
MSVC 2003 toolkit 32-bit fails on excessive warnings without const, if -Wall is set, otherwise accepts either version


So, I'm satisfied that 'const char *' is the correct solution, and that no consistent treatment of legacy code (warning/abort/no warning/STL failure) can be expected of current compilers.

Thanks,
Tim


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]