This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: gcc 4.1.1: char *p = "str" puts "str" into rodata
On Sun, 2007-01-28 at 15:41 -0800, Ray Hurst wrote:
> Shouldn't the compiler error out here.
> The statement: p = "" should have been p = '\0';
> Or does the compiler treat them as equivalent.
>
> It seems that only characters should be assigned to char's and strings
> are illegal
Read about the option -Wwrite-strings:
-Wwrite-strings In C++, nonzero means warn about deprecated
conversion from string literals to `char *'. In
C, similar warning, except that the conversion is
of course not deprecated by the ISO C standard.
-- Pinski