Thread overview
Spec Clarification: Initializing arrays with arrays
Sep 06, 2001
Russ Lewis
Sep 07, 2001
Walter
Sep 07, 2001
Russ Lewis
Sep 07, 2001
Walter
September 06, 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)?

September 07, 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)?
>


September 07, 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?


September 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.