Pointer aliasing in D (Was: Programming language benchmarks)

bearophile bearophileHUGS at lycos.com
Thu Apr 28 15:31:29 PDT 2011


Jens Mueller:

> That allows specifying that the memory pointed to is only readable which
> enables doing the optimizations. But what if the memory is writable but
> I can my sure that the pointers pointing to it will never alias? How do
> I pass that information to the compiler?

Here's my answer. I think you can't do it, currently. To do it you have to rely on the programmer like C does, or enforce it statically, like some languages with advanced type systems do. By general design decision D generally wants to enforce its attributes, this removes the first option. I presume the second option requires type system complexities that D doesn't want, at the moment (like linear types).

Bye,
bearophile


More information about the Digitalmars-d mailing list