Re: Are string literals _always_ allocated in the RO section?

Dale Johannesen <[email protected]>
Newsgroups gmane.comp.gcc.devel,gmane.linux.gcc
Message-ID <[email protected]>
On Jan 15, 2005, at 1:22 PM, Denis Zaitsev wrote:

> This program:
>
> void x(char *s)
> {
>     *s= 'x';
> }
>
> main()
> {
>     x("y");
> }
>
> is compiled plainly but cathes SIGSEGV in the
>
>         *s= 'x'
>
> line.

That's what's supposed to happen.  Storing into a string
constant is invalid C.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.