Loop optimization

Ali Çehreli acehreli at yahoo.com
Sat May 15 17:49:32 PDT 2010


Simen kjaeraas wrote:
 > Ali Çehreli <acehreli at yahoo.com> wrote:
 >
 >> Steven Schveighoffer wrote:
 >>
 >>  >     double [] foo = new double [cast(int)1e6];
 >>  >     foo[] = 0;
 >>
 >> I've discovered that this is the equivalent of the last line above:
 >>
 >>    foo = 0;
 >>
 >> I don't see it in the spec. Is that an old or an unintended feature?

I have to make a correction: It works with fixed-sized arrays. It does 
not work with the dynamic array initialization above.

 > Looks unintended to me.  In fact (though that might be the
 > C programmer in me doing the thinking), it looks to me like
 > foo = null;. It might be related to the discussion in
 > digitalmars.D "Is [] mandatory for array operations?".

Thanks,
Ali


More information about the Digitalmars-d-learn mailing list