Posted by: arch119 August 3, 2005
Information technology
Login in to Rate this Post:     0       ?        

>> Try MSDEV.EXE in XP. I did. it works just fine. No need to. I trust you in that. (I don't get surprised at anything that occurs on Windows) >> Which compiler you trust more? GCC or MSDEV.EXE? You give me 2 choices: an open source compiler which was used even to compile linux and disscussions about which still goes on among renowned programmers all around the world and a compiler written by a couple of programmers and is used by nobody around me and you ask me which one I trust. Please take a guess ( Ya! you are right .). >> And where has K&R said that "abcde" has to be protected? Did you read the book b4 you asking this question? If not , please do. In K&R Sec. 5.5 p.104, they have explicitly mentioned that an attempt to change the characters of a string constant will give unexpected results. Now , an operation that may give unexpected results , should not be permitted at all and that was the reason GNU ppl discouraged it completely by making the operation fail every time rather that showing inconsistent behaviour. Anyway, do u think K&R cud have written everything abt C in that small "white book" ? >There is an oversight on part of the GCC by doing just that. I let you find it. You are too quick to arrive at conclusions. Please go thru ANSI Sec. 3.1.4, Sec. 3.5.7 ISO Sec. 6.1.4, Sec. 6.5.7 b4 blaming any party. Now just blame the ppl who make the standards . One can always do that :-) >char *p = "abcde"; >const char *p = "abcde"; >The second one explicitly tells the compiler that content should be protected. Agree on that. .
Read Full Discussion Thread for this article