This is the mail archive of the
mailing list for the GCC project.
Re: C++ diagnostic PATCH: fix pr 8586
- From: Paolo Carlini <pcarlini at suse dot de>
- To: Gabriel Dos Reis <gdr at cs dot tamu dot edu>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 20 Nov 2006 02:29:24 +0100
- Subject: Re: C++ diagnostic PATCH: fix pr 8586
- References: <firstname.lastname@example.org>
2006-11-19 Gabriel Dos Reis <email@example.com>out of curiosity, I checked the documentation, and I'm not completely
sure it's consistent with the new behavior of -Wall, in particular the
last sentence of the below. Also, the -Wwrite-strings entry is grouped
together the other options not implied by -Wall...
* c-opts.c (c_common_handle_option): Enable -Wwrite-strings if -Wall.
What do you think?
When compiling C, give string constants the type |const
char[|length|]| so that copying the address of one into a
non-|const| |char *| pointer will get a warning; when compiling C++,
warn about the deprecated conversion from string literals to |char
*|. This warning, by default, is enabled for C++ programs. 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 prototypes. Otherwise, it
will just be a nuisance; this is why we did not make -Wall request