Atila Neves:

D:
     struct Foo { int i; int j; }
     extern(C++) void useFoo(ref const(Foo) foo);

C++:
     struct Foo { int i; int j; };
     void useFoo(const Foo& foo) { ... }

This doesn't look very safe because D const is transitive, unlike the C++ const. So in the C++ code you can mutate inner data inside foo and the D code will assume such data is not changed.

Bye,
bearophile

Reply via email to