In C:
int a[10];
printf("%p\n", a);
printf("%p\n", &a[0]);
Productivity:
0x7fff5606c600
0x7fff5606c600
This is what I expect. Now, in D, I'm trying to do this (obviously not to use, just cheat):
int[] slice = [...];
writeln(&slice);
writeln(&slice[0]);
Productivity:
7FFF51600360
10E6E9FE0
Why is the difference? Looks like a completely different segment of memory. (Although it occurred to me that perhaps the arrays in D are not just contiguously allocated ints?)
source
share