Forum

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.

Moderator: InsideQC Admins

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

Postby revelator » 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 :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.
User avatar
revelator
 
Posts: 2518
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

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

Postby revelator » Wed Jun 11, 2014 5:59 pm

wth ??? double posted it seems :shock:
Productivity is a state of mind.
User avatar
revelator
 
Posts: 2518
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger


Return to General Programming

Who is online

Users browsing this forum: No registered users and 1 guest