On Friday, 17 August 2012 at 02:02:51 UTC, Jonathan M Davis wrote:
Because there are plenty of functions which take mutable objects but don't actually alter them - particularly when interacting with C code.



Ah, so that explains that, thanks.

So to clarify, modifying a mutable object through casting away a const reference is undefined in D, but valid in C++.

Now the only question is what guarantees that actually gives you that the compiler can use for optimization (aliasing issue above^).

Reply via email to