On Thu, 21 May 2009 05:58:04 -0400, MLT wrote:
>> 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
> 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 l
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
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 extensio
On Thu, 21 May 2009 04:51:16 -0400, MLT wrote:
> After a discussion on digitalmars.D I played with arrays a bit. Look at the
> following code:
> int[] a = [1,2,3,4,5,6,7,8,9] ;
> int[] b = a ;
> a ~= 10 ;
> b ~= 11 ;
> b[0] =
After a discussion on digitalmars.D I played with arrays a bit. Look at the
following code:
int[] a = [1,2,3,4,5,6,7,8,9] ;
int[] b = a ;
a ~= 10 ;
b ~= 11 ;
b[0] = 12 ;
Stdout(b).newline ;