Posted by: testdirector August 5, 2005
Information technology
Login in to Rate this Post:     0       ?        
Nothing wrong! Very good, in fact! I still think, to blame GCC:-), a compiler should not put the strings in ROM (unless the user has explicitly asked for protection using a key word such as const, in which case the compiler can make a decision what to do depending upon conditions). There is apparently two schools of thought for this statement out there in the IT world. In as simple a program as we have discussed, the user has seemingly done nothing wrong, no explicit warning or error, and it crashes for the reason that K&R, for some reason, had to allow the caveat and compilers are adhering to it. It's wrong, I think, for GCC to punish users for trying to use the string space. If the program crashes after the change of content at some point later on just because of the change, I understand it's up to the user to figure out, but as the fact of matter is, so be it. The user, of course, should avoid the modification of strings the way we've discussed. Just a thought!
Read Full Discussion Thread for this article