This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/50645] old issue - deprecated conversion from string to char*
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 07 Oct 2011 00:44:12 +0000
- Subject: [Bug c/50645] old issue - deprecated conversion from string to char*
- Auto-submitted: auto-generated
- References: <bug-50645-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50645
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-10-07 00:44:12 UTC ---
(In reply to comment #1)
> but LOGICALLY you don't want I warning when passing a string literal to a char*
> parameter in a function.
Yes you do. A string literal is immutable. A function taking a non-const char*
implies it might modify the characters pointed to. Modifying immutable data is
bad, mmmkay?
If your function won't change the data, change its signature to const char*.