[mythtv] Casts revisited: reinterpret_cast<>, dynamic_cast<>

Joseph A. Caputo jcaputo1 at comcast.net
Fri Oct 22 15:04:43 UTC 2004


On Friday 22 October 2004 10:53, Daniel Thor Kristjansson wrote:
> Also, I'm not using any
> dynamic_casts but it occured to me that these could be a problem,
> since there is no C equivalent. A google revealed that gcc 2.9.x
> supports them, but it uses some wacky string search so they are
> extremely slow.

Only a partial solution, I know, but for anything that inherits from 
Qt's QObject class (and properly uses the Q_OBJECT macro in its 
header), you can use the following function as a poor man's 
dynamic_cast:

bool QObject::inherits( const char * className )

Won't be useful in parts of the code that don't use Qt much, though.

-JAC


More information about the mythtv-dev mailing list