Cannot cast void* to arrays..?

simendsjo simendsjo at gmail.com
Fri Feb 24 12:14:58 PST 2012


On Fri, 24 Feb 2012 20:56:22 +0100, H. S. Teoh <hsteoh at quickfur.ath.cx>  
wrote:

>> 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[]
> [...]
>
> Just out of curiosity, what are you trying to accomplish with this cast?
> In almost all normal D code, there's no need for any casting at all.
>
>
> T
>

Interacting with a C callback taking a void*. In my callback, I want to  
get the same type back.
See my previous question:  
http://forum.dlang.org/post/op.v963zyg0x8p62v@simendsjo-desktop (although  
I didn't include the parameters in that example)


More information about the Digitalmars-d-learn mailing list