@safe std.file.read

Dominikus Dittes Scherkl dominikus.scherkl at continental-corporation.com
Mon Jan 6 11:11:54 UTC 2020


On Monday, 6 January 2020 at 10:07:37 UTC, WebFreak001 wrote:
> I was wondering, how are you supposed to use std.file : read in 
> @safe code when it returns a void[] but you want to get all 
> bytes in the file?
>
> Is void[] really the correct type it should be returning 
> instead of ubyte[] when it just reads a (binary) file to 
> memory? Or should void[] actually be castable to ubyte[] in 
> @safe code?

I definitely think it should return ubyte[].
void[] is a very special abstraction that shouldn't be used at 
all if you don't know very well what you're doing.


More information about the Digitalmars-d-learn mailing list