Cannot cast void* to arrays..?

Justin Whear justin at economicmodeling.com
Fri Feb 24 11:42:20 PST 2012


On Fri, 24 Feb 2012 20:34:19 +0100, simendsjo wrote:

> char[] a;
>      auto b = cast(void*)a;
>      auto c = cast(char[])b; // Error: e2ir: cannot cast b of type void*
>      to
> type char[]

Arrays have a length--you need to cast the pointer to a char*, then slice 
it.


More information about the Digitalmars-d-learn mailing list