D - Spec Clarification: Initializing arrays with arrays
- Russ Lewis (5/5) Sep 06 2001 If we have this code:
- Walter (3/8) Sep 06 2001 By reference. To do a copy by value:
- Russ Lewis (6/8) Sep 07 2001 So
- Walter (2/11) Sep 07 2001 Actually, there's no way to initialize a dynamic array by value.
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:Actually, there's no way to initialize a dynamic array by value.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