Object as function argument
anonymous via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Mar 5 12:30:54 PST 2015
On Thursday, 5 March 2015 at 19:51:09 UTC, Max Klyga wrote:
> If you really need the actual pointer to object data you can
> use `*cast(void**)&myObject`. Compiler cannot cast object
> reference to `void*` but we can trick it ;)
It can, actually. A class can define its own cast(void*) though,
so the reinterpret way may be more robust. Also, I'm not sure if
any of this is specified. So watch out for undefined (or
underspecified) behaviour.
More information about the Digitalmars-d-learn
mailing list