Christopher Smith on 1 Oct 2003 05:49:49 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [ALACPP] Why won't g++ tell me I'm dumb?


On Tue, 2003-09-30 at 22:41, Josh Dybnis wrote:
> C89 is the same as C99 on this point. But I was wrong about C++. The
> C++ standard explicitly says string literals have type "array of n
> const char" (section 2.13.4.1). But also retains that modifying a
> string literal is "undefined" and not forbidden.
> 
> This does mean the original question is unanswered. The documentation
> seems to be wrong about the behavior of gcc. Perhaps this behavior is a
> bug in gcc. I tried it with the option -fconst-strings. It still
> doesn't generate a warning. I would search in the gcc bug database
> before sending off a bug report.

Yeah, VS.NET 2002 will compile this, but apparently VS.NET 2003 will
not. I could *swear* I've run in to instances where g++ also treated
string literals as const char[]'s (typically when I wished them to be
treated as const char*'s), but as of yet I have not been able to get it
to do anything like that.

For those who are messing with g++ on this, I also tried doing
"-std=c++90".

One thing I have just realized is that I am doing this with gcc-3.2. I
use 3.3 at work a lot, so it is possible that this is something that
changed with gcc-3.3. I'll check this out tomorrow.

--Chris
_______________________________________________
alacpp mailing list
alacpp@xxxxxxxxxxx
http://lists.ellipsis.cx/mailman/listinfo/alacpp