On 10/17/17 7:32 PM, flamencofantasy wrote:
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);
}
The second is wrong. You are asserting that the storage of p is not on
the stack, but it is.
What p *points at* is not on the stack.
So the correct call should be:
assert(!(*p).onStack);
or (IMO) less ugly: assert(!onStack(*p));
-Steve