Handling arbitrary char ranges
ag0aep6g via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Apr 20 14:04:17 PDT 2016
On 20.04.2016 22:09, Matt Kline wrote:
> I'd rather not write my own cURL wrapper. Do you think it would be
> worthwhile starting a PR for Phobos to get it changed to ubyte[]? A
> reading of https://dlang.org/spec/arrays.html indicates the main
> difference is that that GC crawls void[], but I would think that
> wouldn't matter for a short-lived buffer being shoveled into libcurl,
> which is, by nature, a copy of the same data somewhere else in your
> program...
I don't know if a PR would be worthwhile. What you say makes sense to
me, but I am by no means an expert here.
As you say, void[] is the safer default with regards to the GC.
It's also simpler to get a void[] from an arbitrary array, as any array
implicitly converts to void[] (given compatible qualifiers). Getting a
void[] from an arbitrary range isn't that simple, but getting a ubyte[]
from an int[] requires some work, too.
void[] is possibly be the better option all around.
More information about the Digitalmars-d-learn
mailing list