On Thu, 22 Apr 1999, Richard Hartman wrote:
> I'm not so sure about that. The first, if declared
>
> const char *foo = "string";
>
> might very well put the "string" into the code segment, but if
> it's declared just as you said (w/o the const) then isn't the
> compiler smart enough to recognize that the string might get
> written to & put it in a data segment? (It's been a while
> since I dealt w/ this kind of stuff, go easy on me <g>)
If I remember right, there is some weird logic going on here (though I may
be thinking of ANSI C++, as opposed to ANSI C), that says that "string" is
indeed a constant, but may be casted to non-const in the 'char * foo =
"string"' assignment without warning or complaint.
If you want GCC to let you write to strings, you ought to give it the
-fwritable-strings option.
--
Kenneth Albanowski ([EMAIL PROTECTED], CIS: 70705,126)