D - Spec Clarification: Initializing arrays with arrays
- Russ Lewis <russ deming-os.org> Sep 06 2001
- "Walter" <walter digitalmars.com> Sep 06 2001
- Russ Lewis <russ deming-os.org> Sep 07 2001
- "Walter" <walter digitalmars.com> Sep 07 2001
If we have this code: int[] first; int[] second = first; Is second initialized by reference (that is, second points into the same memory as first), or by value (a new copy is made)?
Sep 06 2001
By reference. To do a copy by value: second[] = first[]; Russ Lewis wrote in message <3B980434.DFCCE2A5 deming-os.org>...If we have this code: int[] first; int[] second = first; Is second initialized by reference (that is, second points into the same memory as first), or by value (a new copy is made)?
Sep 06 2001
Walter wrote:By reference. To do a copy by value: second[] = first[];
So int[] second = first; initializes by reference, while int[] second = first[]; initializes by value?
Sep 07 2001
Russ Lewis wrote in message <3B987832.7B8B6B19 deming-os.org>...Walter wrote:By reference. To do a copy by value: second[] = first[];
So int[] second = first; initializes by reference, while int[] second = first[]; initializes by value?
Actually, there's no way to initialize a dynamic array by value.
Sep 07 2001








"Walter" <walter digitalmars.com>