On 10/10/23 10:54 PM, mw wrote:
Hi,

I want to confirm: in the following loop, is the array literal `a` vs. `b` stack or heap allocated? and how many times?

ask the compiler:

```d
void main() @nogc {

int[2] a;
int[] b;

int i;
while(++i <=100) {

  a = [i, i+1];  // array literal
  //b = [i, i+1]; // yes, this allocates, had to comment it out

}

}
```

-Steve

Reply via email to