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*’

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.musoftware.de!wum.musoftware.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Ian Collins <ian-news@hotmail.com>
Newsgroups comp.lang.c++
Subject Re: g++: warning on deprecated conversion from string constant to ‘char*’
Date Sun, 12 Feb 2012 14:25:10 +1300
Lines 24
Message-ID <9poinnFr4aU5@mid.individual.net> (permalink)
References <jh6o65$5nh$1@speranza.aioe.org> <jh6o8g$5nh$2@speranza.aioe.org>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 8bit
X-Trace individual.net kW4XxoZmeqccKKoKVypq8wdaA8sM/q8eePjQ0MSm31rte/Thyq
Cancel-Lock sha1:48inOMJcKdwSpY/izILfLGw6lQ0=
User-Agent Mozilla/5.0 (X11; SunOS i86pc; rv:6.0.2) Gecko/20111003 Thunderbird/6.0.2
In-Reply-To <jh6o8g$5nh$2@speranza.aioe.org>
Xref x330-a1.tempe.blueboxinc.net comp.lang.c++:13928

Show key headers only | 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