看板 DFBSD_submit 關於我們 聯絡資訊
On Sun, Feb 27, 2005 at 03:45:39PM -0800, Kevin M. Kilbride wrote: > The documentation for the compiler actually points out the problem with > the write-strings option: > > "These warnings will help you find at compile time code that can try to > write into a string constant, but only if you have been very careful > about using const in declarations and prototype. Otherwise, it will just > be a nuisance; this is why we did not make -Wall request these warnings." > > It should be removed from WARNS=6. No. Code has to understand that there is a difference between: const char * char * char [] The first is a pointer to a character constant, the second to a character [field] and the third is a field. E.g. if you want to define a modificable character constant, char *foo = "bar"; is wrong. That's a pointer to "bar", the correct syntax is char foo[] = "bar" We still want to be very careful about the qualifiers used in interfaces, but we have to live with the few cases we can't change them. Joerg