Obtain pointer from static array literal

codic codic at linuxmail.org
Fri Oct 8 21:50:18 UTC 2021


On Friday, 8 October 2021 at 06:59:32 UTC, Nicholas Wilson wrote:
> On Friday, 8 October 2021 at 05:31:21 UTC, codic wrote:
>>> [...]
>
>> [...]
>
> No, I meant what I said. The array literal will cause a GC 
> allocation, unless it is assigned to a static array of the same 
> length or is inferred to be a static array. The latter happens 
> when you pass it to `staticArray` because staticArray takes a 
> static array as a parameter and the literal is inferred to be 
> static array instead of a dynamic array, which is the default.
>
> [...]

Clears that up, thank you very much for your reply!


More information about the Digitalmars-d-learn mailing list