Obtain pointer from static array literal

codic codic at linuxmail.org
Fri Oct 8 05:31:21 UTC 2021

On Friday, 8 October 2021 at 05:01:00 UTC, Nicholas Wilson wrote:
> For simple types (i.e. ones with no destructor), like int, IIRC 
> this is fine.
Thanks, perfect!
> note that if the pointer is not escaped from the function (i.e. 
> thing is void thing(scope int* abc)note the addition of scope) 
> LDC will perform promotion of GC allocation to stack of the 
> array literal even if you don't use .staticArray.
Interesting, I think you meant "even if you do use .staticArray"; 
not sure why it would do that, but it doesn't matter because my 
code is betterC and therefore nogc so it *should* allocate it on 
the stack, I think

More information about the Digitalmars-d-learn mailing list