[Issue 1869] Semantically returning an array from a funciton is difficult

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Feb 25 21:11:48 PST 2008


http://d.puremagic.com/issues/show_bug.cgi?id=1869





------- Comment #11 from shro8822 at vandals.uidaho.edu  2008-02-25 23:11 -------
traditionally arrays are worked by pointer math. While the array is a segment
of memory, its manifestation in the code is as a pointer. So "i[2]" takes a
pointer adds an offset of 2 and does the IO. From this "int[4]*" will be a
pointer to something that can be used like a an array, e.i. it will be a
pointer to a somewhat hidden pointer.

IIRC back in C, the compiler didn't make any distinction between an array name
and a pointer. In fact they don't worry about what is the array and what is the
index. 

This actually works (or did at one point):

int i[10];
7[i] = 4;


-- 



More information about the Digitalmars-d-bugs mailing list