Re: going beyond your bounds

2009-05-21 Thread Derek Parnell
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

Re: going beyond your bounds

2009-05-21 Thread MLT
> 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

Re: going beyond your bounds

2009-05-21 Thread Derek Parnell
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

Re: going beyond your bounds

2009-05-21 Thread MLT
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

Re: going beyond your bounds

2009-05-21 Thread Derek Parnell
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] =

going beyond your bounds

2009-05-21 Thread MLT
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 ;