For new devs working on Doom3 or other C++ projects
Posted: Wed Jun 11, 2014 3:36 pm
This was something i came across while changing C style casts to C++.
in some cases both static_cast and reinterpret_cast are treated by the compiler as valid, so heres a huge warning newer use reinterpret_cast in those cases, use static_cast.
reinterpret_cast changes the type casted to the type it is casted to and you are pretty much screwed if you modified a large source like Doom3 when it starts to act weird.
I just spent the last 8 hours reverting a huge chunk of code because of this .
Newer the less reinterpret_cast is sometimes nesseary like when casting *pointers to other *pointers static_cast will throw an error here but be carefull.
in some cases both static_cast and reinterpret_cast are treated by the compiler as valid, so heres a huge warning newer use reinterpret_cast in those cases, use static_cast.
reinterpret_cast changes the type casted to the type it is casted to and you are pretty much screwed if you modified a large source like Doom3 when it starts to act weird.
I just spent the last 8 hours reverting a huge chunk of code because of this .
Newer the less reinterpret_cast is sometimes nesseary like when casting *pointers to other *pointers static_cast will throw an error here but be carefull.