This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: warn/croak on "string" "string" auto-joins


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]