cpp_binder, a not-yet-useful tool for generating C++ bindings
Ola Fosheim Grøstad via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Tue Sep 22 08:33:38 PDT 2015
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
> mangling.
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.
More information about the Digitalmars-d-announce
mailing list