[Issue 2075] Spec does not specify how array literals are stored.
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue May 6 13:04:32 PDT 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2075
------- Comment #1 from tomas at famolsen.dk 2008-05-06 15:04 -------
Code to see for yourself:
extern(C) int printf(char*, ...);
int[] func()
{
int[] arr = [1,2,3];
return arr;
}
void main()
{
int stack;
int[] arr = func();
printf("%d %d %d\n", arr[0], arr[1], arr[2]);
printf("stack: %p\nwhere? %p\n", &stack, arr.ptr);
int[] arr2 = [1,2,3,4,5];
printf("where? %p\n", arr2.ptr);
}
--
More information about the Digitalmars-d-bugs
mailing list