> Because new elements are pre-initialized in D.
> 
> Just by increasing the length, you 'create' a new element (from the 'b'
> point of view) so D initializes it.

(We were talking about something like
int a[] = [1,2,3,4,5] ;
b = a ;
a ~= 6 ;
b.length = b.length+1;)


Hmmm... yes, that has some logic to it.

D does keep track of the actual array of integers that both a and b point to
and knows when to allocate new memory for the array. So in theory it could be 
possible that when b.length increases, initialization only happens if this 
memory is uninitialized.
On the other hand, I guess that if you get an array, say b, in a function, you 
might rely on the fact that when you extend b.length, the area will be 
initialized...


Reply via email to