<div dir="ltr"><div><div>So I'm interacting with C (although it works the same in D), I call a function that returns a pointer, and gives the size through an out arg:</div><div> ubyte* test(size_t* ptr)</div><div> {</div>
<div><span class="" style="white-space:pre"> </span>*ptr = 100;</div><div><span class="" style="white-space:pre"> </span>return cast(ubyte*)1234;</div><div> }</div></div><div><br></div><div><br></div><div>And call it, but immediately use the size argument to slice a range:</div>
<div> size_t size;<br></div><div> ubyte[] t = test(&size)[0..size];</div><div><br></div><div>t is null.</div><div><br></div><div>If I do this, it works:</div><div><div> size_t size;<br></div><div> ubyte* pt = test(&size);</div>
<div> ubyte[] t = pt[0..size];</div></div><div><br></div><div>Why should I need that extra line?</div></div>