cast ref pointer

Luís Marques luis at luismarques.eu
Thu Jan 18 16:25:00 UTC 2018


On Thursday, 18 January 2018 at 16:08:32 UTC, Adam D. Ruppe wrote:
> Simply define an intermediate.
>
> int* tmp = cast(int*) that_void_pointer;
> foo(tmp);

In my actual case bar also receives its pointer by ref, so you 
would have to do something like:

int* tmp = cast(int*) that_void_pointer;
foo(tmp);
that_void_pointer = tmp;

This is a bit more noisy than what I would prefers (a more care 
is needed to check if this is properly optimized away), that's 
why I was looking for a more direct route, like a cast.


More information about the Digitalmars-d-learn mailing list