going beyond your bounds
Derek Parnell
derek at psych.ward
Thu May 21 02:40:25 PDT 2009
On Thu, 21 May 2009 05:37:59 -0400, MLT wrote:
> Derek Parnell Wrote:
>
>>
>> So remember, assigning one array to another is just creating an alias to
>> the original array. You end up with two arrays pointing to the same data
>> buffer.
>
> Yes. My question relates to what happens when you go beyond the bounds originally assigned.
> Why does an extension of an array
> b.length = b.length+1 ;
> erase (initialize) the data that b extends to?
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.
--
Derek Parnell
Melbourne, Australia
skype: derek.j.parnell
More information about the Digitalmars-d-learn
mailing list