Pointer aliasing in D (Was: Programming language benchmarks)
Jens Mueller
jens.k.mueller at gmx.de
Thu Apr 28 14:14:10 PDT 2011
Walter Bright wrote:
> On 4/28/2011 11:44 AM, Jens Mueller wrote:
> >Thanks. So if a compiler can assume that pointers do not alias it can
> >generate much better code. What's D's standpoint on that matter then?
> >C99 has restrict. I never came across something similar in D.
>
> Const and immutable.
>
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?
Jens
More information about the Digitalmars-d
mailing list