std.file.read returns void[] why?

monarch_dodra via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Apr 18 08:42:36 PDT 2014


On Friday, 18 April 2014 at 13:08:04 UTC, Steven Schveighoffer 
wrote:
> I admit, I didn't think C's void had a size ;) I'm pretty sure 
> it doesn't in D, but then again...
>
> -Steve

Yeah... "static assert(void.sizeof == 1);" passes :/

So in any case, long story short:
"void[]": This is an un-typed buffer, pointing to a memory 
location that starts at .ptr, and is .length bytes in length.

Also, as far as the GC is concerned, "void" is a type that should 
be scanned (whether or not the data originally allocated was 
marked as such is another issue).


More information about the Digitalmars-d-learn mailing list