On Monday, 31 August 2015 at 22:03:07 UTC, jmh530 wrote:
In general, I find myself very easily getting mixed up by the
syntax of the static vs. dynamic arrays. For instance, compare
int x = new int;
int y = new int;
auto z = new int;
x and y are obviously dynamic and static arrays, respectively.
However, my initial guess on z is that is like y, a static
array on the heap. But that is wrong. It's actually like x.
Easy to get confused.
In general, "new" means heap allocation.
I wonder about the initialization of y. Maybe it creates a
temporary dynamic array on the heap and then copies it to the
static array on the stack?