Re: gcc 4.1.1: char *p = "str" puts "str" into rodata

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

 



On Sunday 28 January 2007 18:49, Andrew Haley wrote:
>  > >  > Don't you think that "" should end up in rw data?
>  > > 
>  > > No: it's a literal string.  Many, many years ago, C compilers put
>  > > literal strings into read/write memory and it was possible to alter
>  > > them, but C89 outlawed that practice.
>  > 
>  > gcc doesn't warn me, it just produces buggy code.
> 
> Not at all.  This is normal C code, and the compiler is correct.  It's
> a read-only string.

So, I assign pointer to read-only string to "char *p", non-constant
pointer variable, and gcc doesn't warn me. Why?

--
vda

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux