On May  9, 2008, Dave Higginbotham <[EMAIL PROTECTED]> 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  [EMAIL PROTECTED], gnu.org}
FSFLA Board Member       ¡Sé Libre! => http://www.fsfla.org/
Red Hat Compiler Engineer   [EMAIL PROTECTED], gcc.gnu.org}
  • Deprecation?! Dave Higginbotham
    • Re: Deprecation?! Alexandre Oliva

Reply via email to