static arrays becoming value types
Don
nospam at nospam.com
Tue Oct 20 01:45:41 PDT 2009
bearophile wrote:
> Don:
>
>> I think this change is mandatory. We need it for SIMD operations.<
>
> Why? Why the compiler can't optimize things and perform SIMD operations with the fixed-sized array semantics of D1? (I ask this for LDC too, that's mostly D1 still).
>
> Bye,
> bearophile
Because they are passed by reference. It certainly can't do it on D1:
float dot(float[4] x) {
x[3] = 4.5; // surprise!
return 0;
}
void main()
{
float[4] a;
a[3]= 0;
float x = dot(a);
assert(a[3]==0); // FAILS!
}
More information about the Digitalmars-d
mailing list