immutable string literal?

strtr strtr at spam.com
Sun Feb 21 14:43:18 PST 2010


On winXP (D1) I can compile/run this code without a problem.
Not even a warning.

void main() {
  char[] s= "immutable literal?";
  s[$-1] = '!';
  writefln(s);
} 
Codepad runs into a segmentation fault.
http://codepad.org/NQfsRoR5

Why doesn't it result in a compiler error or warning?
If it did I would have noticed this quirk earlier.


More information about the Digitalmars-d-learn mailing list