On 2012-06-26 02:56, Pierre Rouleau wrote:
Hi all,

inside http://dlang.org/dmd-windows.html#environment down in the section
titled Differences between Windows and Linux versions, the statement is:

"String literals are read-only under Linux. Attempting to write to them
will cause a segment violation."

This looks like an old and obsolete statement related to early
implementations. Isn't the compiler preventing writing to write to
string literals?

Or is this statement there to want you not take the address of a string
literal and attempt to write it via a pointer?

In both case, I think the statement should be modified (removed or
clarified). Am I reading this correctly?

This is still true for D1 which doesn't have immutable or const. Where this is legal:

char[] str = "asd";
str[0] = 'b'; // ok on windows, segfault on posix

--
/Jacob Carlborg

Reply via email to