On Tuesday, 22 September 2015 at 15:11:55 UTC, Kagamin wrote:
Another C feature you didn't know about: the standard allows to
create a mutable pointer to const data and mutate it.
I didn't? Of course I did. In C++ other threads can write to
const objects. The function receiving a const objects is not
supposed to write to const. Const cast is supposed to be used for
calling legacy const interfaces without a const signature.
But most of the time when you see const in C, it works as
expected, so usually there shouldn't be a problem except for
No it doesn't. C++ even has an override for const object fields
called "mutable", so that you can have things like reference
counts in const objects.
Either D const is _always_ ensured or the compiler have to assume
that it is _always_ violated after FFI.