Obtain pointer from static array literal

russhy russhy at gmail.com
Sat Oct 9 14:27:16 UTC 2021

On Saturday, 9 October 2021 at 10:44:30 UTC, Some Guy wrote:
> On Friday, 8 October 2021 at 14:07:27 UTC, russhy wrote:
>> https://run.dlang.io/is/S8uMbp
> Maybe this is kind of unrelated, but what is happening here and 
> why does it work?
> It looks like you've replaced the GC's allocation functions 
> with custom ones, but I couldn't find any documentation on how 
> to do that.

it is to track and crash whenever there is a GC allocation, 
usefull when you don't want any GC usage in your code, you put a 
debugger and you know exactly what is the culprit

here it panics because [0,1,2,3] will allocate usign the GC, wich 
is not something you want

> No idea, but why isn't just slapping a staticArray sufficient?
> I feel your rage, but maybe there was a good reason for it :)

It should be the other way around, if you want it to be allocated 
using GC? you should import a package [0,1,2,3].new()

More information about the Digitalmars-d-learn mailing list