Hi -
var Inner = A[1..9];
I think earlier emails said it is done as a shallow copy.
That copies the array elements, so I wouldn't call it a shallow copy.
ref aliasing = A[1..9];
would alias the other array. It creates an array slice descriptor (the A[1..9]
part does) and so that involves a memory allocation.
I tend to prefer using entire (short) programs for discussion. Here
is one that you can possibly use to see what's going on with
these array initialization from slice statements:
var A = [1,2,3,4,5,5,6,7,8,9,10];
var Inner = A[1..9];
ref aliasing = A[1..9];
Inner[1] = 100;
aliasing[2] = 200;
writeln(A);
Cheers,
-michael
What is the true overhead of this? I assume it is much more than pointing
inside an array because it has to be able to deal with non-unit strides or
am I over-complicating/over-simplifying it?
Regards - Damian
Pacific Engineering Systems International, 277-279 Broadway, Glebe NSW 2037
Ph:+61-2-8571-0847 .. Fx:+61-2-9692-9623 | unsolicited email not wanted here
Views & opinions here are mine and not those of any past or present employer
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Chapel-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-developers
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Chapel-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-developers