On Sunday, 7 April 2019 at 10:05:26 UTC, kdevel wrote:
In § 28.3 Pointers and the Garbage Collector [1] we readDo not add or subtract an offset to a pointer such that the result points outside of the bounds of the garbage collected object originally allocated.[...]
No the foo() code would work in D too but in D since we have a true array type with ptr+length you should not write this kind of code, which is not @safe BTW.