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/30622] char *p; p = "str"; puts "str" into rodata



------- Comment #5 from vda dot linux at googlemail dot com  2007-01-28 17:40 -------
http://david.tribble.com/text/cdiffs.htm#C99-string-const

"In C, string literals have type char[n], but are not modifiable (i.e.,
attempting to modify the contents of a string literal is undefined behavior)."

In light of this, char msg[] = "wow" starts to look "strange". Oh well. If the
definition above is really what C99 says (I am not an C99 expert), maybe a
warning would be in order for such code?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30622


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