Walter:
> 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.
I don't understand. "restrict" means "this pointer has no alias". So how is
const/immutable helping foo being optimized assuming a.ptr and b.ptr are
distinct?
void foo(const float[] a, const float b[]) {}
void main() {
const float[] a = [1.5, 2.5];
foo(a, a);
}
Bye,
bearophile