testing if data is allocated on the stack or heap

flamencofantasy flamencofantasy at gmail.com
Tue Oct 17 23:32:13 UTC 2017


On Tuesday, 17 October 2017 at 17:27:17 UTC, Biotronic wrote:
> On Tuesday, 17 October 2017 at 15:33:02 UTC, drug wrote:
>> [...]
>
> I have very little knowledge about sbrk, so here's my solution.
>
> Tested on win32 and win64.
>
> [...]

Try this;

unittest {
     int[5*1024] n;
     int* p = new int;

     assert(n.onStack);
     assert(!p.onStack);
}


More information about the Digitalmars-d-learn mailing list