BTW, this has a segfault in Linux, so it's definitely trying to overwrite immutable data.Does it also segfault with string buf?No. Now I'm confused :)
On Linux strings are put into some read-only space.I guess an immutable(char[]) also puts the pointer and length into that storage.