This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: warn/croak on "string" "string" auto-joins
- From: Robert Dewar <dewar at gnat dot com>
- To: Adam Monsen <haircut at gmail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 17 Aug 2004 18:57:11 -0400
- Subject: Re: warn/croak on "string" "string" auto-joins
- References: <9ebd65110408171032227968ea@mail.gmail.com>
Adam Monsen wrote:
String auto-joins can be dangerous. Is there a way to tell the
compiler to warn/croak when an auto-join occurs?
Seems a bit odd to warn on a perfectly normal non-suspicious
usage.
For instance, find the bug in this code:
char *months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul",
"Aug" "Sep", "Oct", "Nov", "Dec"};
To me there is no bug, though for sure I can guess that the programmer
did not mean to make the 8'th entry 6 characters long.
If not, I'd like to suggest a way to ask the compiler to strictly
check for this.
I suppose a warning flag would be innocuous, provided it was not
included in -Wall.