This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/50645] old issue - deprecated conversion from string to char*


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]