[phobos] returning void[] from std.file.read()
Michel Fortin
michel.fortin at michelf.com
Sat Sep 25 18:45:08 PDT 2010
Le 2010-09-25 à 17:17, Andrei Alexandrescu a écrit :
> This has come up in http://d.puremagic.com/issues/show_bug.cgi?id=1482. Should std.file.read() return void[] or ubyte[]? There's one matter with assuming that void[] may contain pointers (which is not the case for something read from a file), so possibly ubyte[] is a more accurate type for describng raw bytes.
>
> What are the pros and cons of returning void[] vs. ubyte[]?
I see no reason to return void[]. The concept of a file is a sequence of bytes, not a sequence of voids. Yes, you might want to cast the file content's to various other data formats, but I fail to see how void[] is better than ubyte[] in that regard.
--
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/
More information about the phobos
mailing list