Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #13928

Re: g++: warning on deprecated conversion from string constant to ‘char*’

From Ian Collins <ian-news@hotmail.com>
Newsgroups comp.lang.c++
Subject Re: g++: warning on deprecated conversion from string constant to ‘char*’
Date 2012-02-12 14:25 +1300
Message-ID <9poinnFr4aU5@mid.individual.net> (permalink)
References <jh6o65$5nh$1@speranza.aioe.org> <jh6o8g$5nh$2@speranza.aioe.org>

Show all headers | View raw


On 02/12/12 10:57 AM, Rui Maciel wrote:
> Rui Maciel wrote:
>
>> While recompiling some code with g++ I've stumbled on the following
>> warning:
>>
>> <warning>
>> warning: deprecated conversion from string constant to ‘char*’
>> </warning>
>>
>> The line in question points to a function that takes a parameter of type
>> char *, which is being called with a string literal being passed as a
>> parameter.
>
> The warning is killed by redefining the function so that it takes a
> parameter of type const char *.

At least one compiler I regularly use has been issuing that warning 
since 1998!

Pass the correct type.

-- 
Ian Collins

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

g++: warning on deprecated conversion from string constant to ‘char*’ Rui Maciel <rui.maciel@gmail.com> - 2012-02-11 21:56 +0000
  Re: g++: warning on deprecated conversion from string constant to ‘char*’ Rui Maciel <rui.maciel@gmail.com> - 2012-02-11 21:57 +0000
    Re: g++: warning on deprecated conversion from string constant to ‘char*’ Ian Collins <ian-news@hotmail.com> - 2012-02-12 14:25 +1300
  Re: g++: warning on deprecated conversion from string constant to ‘char*’ Rui Maciel <rui.maciel@gmail.com> - 2012-02-11 22:13 +0000

csiph-web