I am using a C library and I'm passing a "user pointer" to it. When I want to obtain the user pointer the library returns it as void*. I'm currently using static_cast in order to de-reference the members of the original pointer.
So my question is: is there a way to check if the static_cast succeeded?
As far as I know static_cast will not return a nullptr on failure, but rather, if I attempt to de-reference the resulting failed pointer it would be UB and probably crash the program...