C interface provides a pointer and a length... wrap without copying?
cy via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Mar 11 18:47:19 PST 2017
On Saturday, 11 March 2017 at 23:43:54 UTC, Nicholas Wilson wrote:
> A string *is* a pointer length pair, an immutable(char)[].
Yes, but surely there's some silly requirement, like that the
pointer must only ever point to garbage collected memory, or
something?
> ubyte[] arr; // or byte/char whatever is the pointed to type
> returned by giveMeTheMemory
> arr = giveMeTheMemory()[0 .. getMeTheLength()];
...guess not! :D
More information about the Digitalmars-d-learn
mailing list