std.file.read returns void[] why?

Regan Heath regan at netmail.co.nz
Thu Apr 17 07:05:49 PDT 2014


On Thu, 17 Apr 2014 13:59:20 +0100, Steven Schveighoffer  
<schveiguy at yahoo.com> wrote:
> It was never possible. You must explicitly cast to void[].

to -> from?

> void[] makes actually little sense as the result of whole-file read that  
> allocates. byte[] is at least usable and more accurate. In fact, it's a  
> little dangerous to use void[], since you could assign  
> pointer-containing values to the void[] and it should be marked as  
> NOSCAN (no pointers inside file data).

I see what you're saying, byte[] is what *is* allocated.. but my point is  
that it's not what those bytes actually represent.

Are you saying void[] *is* currently marked NOSCAN?

> However, when using the more conventional read(void[]) makes a LOT of  
> sense, since any T[] implicitly casts to void[].

Indeed. :)

R

-- 
Using Opera's revolutionary email client: http://www.opera.com/mail/


More information about the Digitalmars-d-learn mailing list