RE: Batch code editing (was: [GD-General] C++ analyzers?)
Brought to you by:
vexxed72
From: <phi...@pl...> - 2002-07-18 22:47:08
|
Brian Hook <bri...@py...>: > I'm still amazed that I get the occasional run-time error with "pure virtual function called" =) That used to throw me, until I realised it's a symptom of re-using a destroyed object. As the chain of destructors is called, the vtbl is overwritten with the vtbl for the layer currently being destroyed, so that the correct virtual functions are called. So if your root class is abstract, you end up with an object that has a vtbl pointing to functions that don't exist. Or in the case of VC++, stub functions that bring up the error box with that warning. If you then try and issue a call to a virtual member of this dead object that was defined, but not implemented in the abstract class, bingo, one really confusing error. Mind you, calling virtual functions in a destructor, is one of those things I just wouldn't do on principle. Cheers, Phil PS Hmm, that's probably clear as mud. |