A
adamrobillard
unsigned char Value1 = 200;
int Value2 = reinterpret_cast<int>(Value1);
Say I want to do something like this. From the C++ standards I am
reading, you should use the reinterpret_cast when casting between
unrelated pointers and integral types.
This line will give me a compiler error. If I use the <static_cast>
instead it works, I get no errors but from the docs it appears that
this is only valid for casting between members of the same class
hierarchy.
Am I missing something from the documentation? Should I be creating a
pointer to an int and then use the reinterpret_cast instread?
int Value2 = reinterpret_cast<int>(Value1);
Say I want to do something like this. From the C++ standards I am
reading, you should use the reinterpret_cast when casting between
unrelated pointers and integral types.
This line will give me a compiler error. If I use the <static_cast>
instead it works, I get no errors but from the docs it appears that
this is only valid for casting between members of the same class
hierarchy.
Am I missing something from the documentation? Should I be creating a
pointer to an int and then use the reinterpret_cast instread?