Can't understand if deallocation happens?
Suliman via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Jan 22 07:51:01 PST 2017
string str = "abc";
writeln(str.ptr);
str = "def";
writeln("last data: ", *(str.ptr));
writeln("old data: ", *(str.ptr-1)); // print nothing
writeln("old data: ", *(str.ptr-2)); // print c
It's look like that there is some gap between data, because `d`
minus 1 should be `c`, but `c` I am getting only if I am doing
`-2`. Why?
More information about the Digitalmars-d-learn
mailing list