Cannot cast void* to arrays..?

Mantis mail.mantis.88 at gmail.com
Fri Feb 24 11:50:20 PST 2012


24.02.2012 21:34, simendsjo пишет:
>     char[] a;
>     auto b = cast(void*)a;
>     auto c = cast(char[])b; // Error: e2ir: cannot cast b of type 
> void* to type char[]
>
Generally, you should not cast a struct to pointer and vise-versa. 
Besides, size of array structure is larger than size of pointer, and 
that triggers error in your case.


More information about the Digitalmars-d-learn mailing list