News for hackers. Stuff that matters.
Re:Coding tricks of game developers by Ogre on Saturday February 11, 2012 @03:29PM (#3580077)
I can't recall the exact details, but just days or maybe a week before gold master of one title I worked on, there was a case where an object's virtual table was getting munged somehow. I do remember I managed to figure out exactly what was happening. But the amount and type of work it would take to fix would have likely delayed shipping.

So I wrote some code that constructed a new object of the same type on the stack, then

  memcpy(&realObject, &stackObject, 
         (char * )&stackObject.m_firstDataMember - (char * )&stackObject));
It worked. I'm not proud of it, but I am amused by it. I'm sure it wasn't guaranteed to work by any standard, but in practice worked fine for us.

There are no comments on this comment yet.