On Thursday, 17 April 2014 at 14:05:50 UTC, Regan Heath wrote:
On Thu, 17 Apr 2014 13:59:20 +0100, Steven Schveighoffer <[email protected]> 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

auto a1 = new ubyte[10];  //NO_SCAN set
auto a2 = new ubyte*[10]; // NO_SCAN not set
auto a3 = new void[10];   //NO_SCAN not set
auto a4 = new void *[10];  //NO_SCAN not set

void [] retains = a1; //NO_SCAN REMAINS SET from the ubyte [] at creation time.

Since read comes straight from the file. It contains no memory pointers
and the NO_SCAN can be set.









Reply via email to