This is the mail archive of the gcc@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: Deprecation?!


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}


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