Is void* compatible with function pointers?

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Mon Jun 23 17:48:34 PDT 2014


If it will work that way on most plateforms, the other way around
can do VERY nasty things, even on common plateforms like ARM.

This is because most CPUs consider the instructions as immutable.
Even x86 do not provide any guarantee (which makes it very hard
to swap implementation outside of a VM).

Casting from void* to function is pretty guaranteed to be
undefined behavior on all plateforms, unless you emit the proper
barriers.


More information about the Digitalmars-d mailing list