These questions are intended to help me understand some of the more
important items in the server .DLL.
They're also intended to get some intelligent discussion going :)


How does SetThink() work? It's defined:
#define SetThink( a ) m_pfnThink = static_cast <void
(CBaseEntity::*)(void)> (a)

With a comment above:
// Ugly technique to override base member functions
// Normally it's illegal to cast a pointer to a member function of a
derived class to a pointer to a
// member function of a base class.  static_cast is a sleezy way around
that problem.

Now I have no real formal training with C++, and that definition looks
really scary. Particularly the CBaseEntity::*
So for those of you _with_ formal training and/or brains, tell me, is this
a common procedure, or is it just a bit of genius on Valve's part?

Bonus question:
#ifdef _DEBUG
#define SetThink( a ) ThinkSet( static_cast <void (CBaseEntity::*)(void)>
(a), #a )
#else

What's the difference for this debug version?


thanks.
--geoff

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to