Original Post
Hi! I am working with an api that lets me store userData as a void*. Now I use this to store a pointer to an object of a class that the api-internal objects are associated with. Since one cannot cast void* directly, I found a way around it:
void Callback( void* ptr )
{
A* a_ptr = dynamic_cast<A*>((A*) ptr);
}
This compiles and apparently works fine (in VS 2008). Is this the right way of doing this/is there something wrong with this?