This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Deprecation?!
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: Dave Higginbotham <dhigginb1 at Comcast dot net>
- Cc: gcc at gnu dot org
- Date: Sat, 10 May 2008 16:07:01 -0300
- Subject: Re: Deprecation?!
- References: <1210385081.6563.4.camel@SOYO.HOME>
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}