In general, no, it is not safe.
Suppose casting Derived* directly on Base* leads to a different address (for example, if multiple inheritance or virtual inheritance is involved).
Now, if you added void* between the command, how does the compiler know how to convert this void* to the corresponding Base* address?
If you need to cast Derived* to void* , you must explicitly port void* back to the original Derived* type. (And from there, casting from Derived* to Base* is implicit anyway, so you end up in the same number of throws and, therefore, it's actually no less convenient.)
jamesdlin
source share