This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Removing -frwitable-strings
On Fri, 19 Dec 2003, Syd Polk wrote:
> The problem with just removing this flag is that there is no
> compile-time indication of the faulty code, and the bug may be a
> little-used path, and the developer who has to track it down may not
> even know anything about it.
-Wwrite-strings is a very good compile-time indication of the faulty code
- you may need to add lots of consts when you first use it, but if you
succeed in making the code const-correct with -Wwrite-strings -Wcast-qual
then you _probably_ don't have many problems of this type (functions such
as strchr could mask them) while if you fail then the failure will
probably lead you to the fault.
> I spent several days tracking one of these down once. I had not been
> aware of gcc's default behavior.
How could we make it more likely that people in future who are in a
similar position to that you were in then will have read the manual;
specifically, the section "Incompatibilities" that explains that strings
are readonly; or the comp.lang.c FAQ, which also mentions the issue?
--
Joseph S. Myers
jsm@polyomino.org.uk