void foo(immutable int* x, int* y) {
bar(*x); // bar(3)
*y = 4; // undefined behavior
bar(*x); // bar(??)
}
...
int i = 3;
foo(cast(immutable)&i, &i);
--
In the 2.065 version, I can compile. But that is not in the
documentation.
There, how to distinguish between const and immutable? thank
you~:)
/**
"Const types are like immutable types, except that const forms a
read-only view of data. Other aliases to that same data may
change it at any time. "
"Any data referenced by the const declaration cannot be changed
from
Thank you all. These answers are very detailed. I think I learned
a lot.
Awesome!!!
Thank you so much!