For new devs working on Doom3 or other C++ projects

Discuss programming topics for any language, any source base. If it is programming related but doesn't fit in one of the below categories, it goes here.
Post Reply
revelator
Posts: 2621
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

For new devs working on Doom3 or other C++ projects

Post by revelator »

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 :S.

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.
Productivity is a state of mind.
revelator
Posts: 2621
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: For new devs working on Doom3 or other C++ projects

Post by revelator »

wth ??? double posted it seems :shock:
Productivity is a state of mind.
Post Reply