void[] and ubyte[]
Stephan
stephan_schiffels at mac.com
Mon Feb 4 16:40:46 PST 2013
Hi,
In phobos there are places with void[] and places with ubyte[],
and I can't really understand why there is this difference. I
don't even see why D has a void array or void pointer anyway.
For example, in std.base64, ubyte[] is used as the basic quantity
for encoding, while in std.zlib, it's void[]. Both libraries have
a similar pair of functions like encode/decode or
compress/uncompress. Both act on raw memory. So why not use
ubyte[] all the time? Isn't any stretch of bare data on the heap
in the end an array of bytes? Void[] seems like a C-anachronism
to me. I have no experience with void pointers or arrays, so I am
probably missing something.
Thanks,
Stephan
More information about the Digitalmars-d-learn
mailing list