[Bug c/61579] -Wwrite-strings does not behave as a warning option
david at westcontrol dot com
gcc-bugzilla@gcc.gnu.org
Wed Jul 22 13:22:37 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61579
David Brown <david at westcontrol dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |david at westcontrol dot com
--- Comment #7 from David Brown <david at westcontrol dot com> ---
Could "-Wwrite-strings" be split into two options? The warning could remain
(and become part of -Wall for C as well as C++) if the compiler can spot and
warn about attempts to write to string literals, while keeping these of type
"char[len]" as required by C.
A new option "-fconst-strings" could be put under "Code Gen Options" which
makes C string literals be type "const char[len]" for those that want it,
encouraging a slightly safer code style that is not standard C.
More information about the Gcc-bugs
mailing list