Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #13918 > unrolled thread
| Started by | Rui Maciel <rui.maciel@gmail.com> |
|---|---|
| First post | 2012-02-11 21:56 +0000 |
| Last post | 2012-02-11 22:13 +0000 |
| Articles | 4 — 2 participants |
Back to article view | Back to comp.lang.c++
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
| From | Rui Maciel <rui.maciel@gmail.com> |
|---|---|
| Date | 2012-02-11 21:56 +0000 |
| Subject | g++: warning on deprecated conversion from string constant to ‘char*’ |
| Message-ID | <jh6o65$5nh$1@speranza.aioe.org> |
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. After a quick google, the suggested fix which pops out the most consists of a convoluted cast, which doesn't look right to me. So, does anyone happens to know how to fix this warning? Thanks in advance, Rui Maciel
[toc] | [next] | [standalone]
| From | Rui Maciel <rui.maciel@gmail.com> |
|---|---|
| Date | 2012-02-11 21:57 +0000 |
| Message-ID | <jh6o8g$5nh$2@speranza.aioe.org> |
| In reply to | #13918 |
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 *. Rui Maciel
[toc] | [prev] | [next] | [standalone]
| From | Ian Collins <ian-news@hotmail.com> |
|---|---|
| Date | 2012-02-12 14:25 +1300 |
| Message-ID | <9poinnFr4aU5@mid.individual.net> |
| In reply to | #13920 |
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
[toc] | [prev] | [next] | [standalone]
| From | Rui Maciel <rui.maciel@gmail.com> |
|---|---|
| Date | 2012-02-11 22:13 +0000 |
| Message-ID | <jh6p5t$7am$5@speranza.aioe.org> |
| In reply to | #13918 |
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> After a quick google, I've noticed this issue was already covered before in this newsgroup. deprecated conversion from string constant to 'char*' http://groups.google.com/group/comp.lang.c++/browse_frm/thread/f8296092aa73 3645/61bdef5b05e0b511?lnk=gst&q=warning%3A+deprecated+conversion+from+strin g+constant+to+%E2%80%98char*%E2%80%99#61bdef5b05e0b511 Rui Maciel
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.c++
csiph-web