Deprecation?!
Alexandre Oliva
aoliva@redhat.com
Sat May 10 19:08:00 GMT 2008
On May 9, 2008, Dave Higginbotham <dhigginb1@Comcast.net> wrote:
> I'm getting a " warning: deprecated conversion from string constant to
> ‘char*’" message in g++ (GCC) 4.2.3 (Ubuntu 4.2.3-2ubuntu7).
> I've always understood there is no such thing as deprecation in C++ (and
> have been proud of this concept). What gives?
In pre-standard versions of C++, (narrow) string literals had type
char[n], as in C, so they could decay to char*. As of the first C++
standard, such string literals have type char const[n], so they decay
to char const*. For backward compatibility, [conv.array]/2 in C++98
specifies a deprecated implicit conversion from string literals to
char*.
> I've always understood there is no such thing as deprecation in C++
Annex D in the C++ Standard specifies a few other deprecated
pre-standard language (mis?)features, defining deprecated as
"Normative for the current edition of the Standard, but not guaranteed
to be part of the Standard in future revisions."
--
Alexandre Oliva http://www.lsd.ic.unicamp.br/~oliva/
Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org}
FSFLA Board Member ¡Sé Libre! => http://www.fsfla.org/
Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org}
More information about the Gcc
mailing list