RE: [GD-General] Overhead of RTTI
Brought to you by:
vexxed72
|
From: Tom F. <to...@mu...> - 2002-12-24 14:12:12
|
I'm talking rubbish of course - you don't need a whole load of GetD3DTexture
functions, just one in the base class and one in D3DTexture itself. Doh.
Brain not in gear...
Tom Forsyth - Muckyfoot bloke and Microsoft MVP.
This email is the product of your deranged imagination,
and does not in any way imply existence of the author.
> -----Original Message-----
> From: Tom Forsyth [mailto:to...@mu...]
> Sent: 24 December 2002 13:58
> To: gam...@li...
> Subject: RE: [GD-General] Overhead of RTTI
>
>
> The easy, if rather messy and special-cased way, is to have a
> whole load of
> functions like this all the way down the hierarchy:
>
> virtual D3DTexture *MyCoolClass::GetD3DTexture ( void )
> {
> // I'm not a D3DTexture you fool.
> return NULL;
> }
>
>
> ...but then for the D3DTexture class it's
>
> virtual D3DTexture *D3DTexture::GetD3DTexture ( void )
> {
> return this;
> }
>
>
> Now sure, this pollutes your namespace with lots of
> GetMyFunkyClassName()
> calls, but if that's all you need to do, it's robust and
> pretty easy to
> understand, and doesn't require any RTTI support.
>
>
> Tom Forsyth - Muckyfoot bloke and Microsoft MVP.
>
> This email is the product of your deranged imagination,
> and does not in any way imply existence of the author.
>
> > -----Original Message-----
> > From: Adrian Cearnau [mailto:ce...@ce...]
> > Sent: 24 December 2002 13:26
> > To: gam...@li...
> > Subject: RE: [GD-General] Overhead of RTTI
> >
> >
> > Hey,
> >
> > It might be a bad design, but now that I've hit this
> problem, I'd also
> > like to know why it happens and how much RTTI would
> *really* hurt. The
> > class hierarchy in discussion has a base Obect class that has a name
> > field and is virtually inherited by all the other classes in the
> > hierarchy. Now I have a Texture class and a RenderTarget class (buth
> > abstract), and in the implementation I have a (say) D3DTexture class
> > that inherits both Texture and RenderTarget. The problem is that the
> > RenderSystem class (the one that does the actual rendering)
> is pretty
> > abstracted itself so it works with Textures and
> renderTargets. At some
> > point I have to cast from Object to D3DTexture and there's where all
> > hell brakes loose. I can't even cast from void * to
> > D3DTexture for that
> > matter (well, the void * was initially a RenderTarget cast of
> > D3DTexture, so yes, it is a whole madness). My bet is on
> > dynamic_cast or
> > modifying the design (I'll probably choose the latter
> > eventually). Seems
> > like hard abstraction would be way easier (and safer) with
> > RTTI enabled.
> >
> > Thanks again,
> > Adrian
> >
> > -----Original Message-----
> > From: gam...@li...
> > [mailto:gam...@li...]
> On Behalf Of
> > Tom Forsyth
> > Sent: Tuesday, December 24, 2002 3:02 PM
> > To: gam...@li...
> > Subject: RE: [GD-General] Overhead of RTTI
> >
> > It's usually far quicker and easier to code it yourself with a few
> > helper
> > functions, unless you actually need the full madness of RTTI.
> >
> > Tom Forsyth - Muckyfoot bloke and Microsoft MVP.
> >
> > This email is the product of your deranged imagination,
> > and does not in any way imply existence of the author.
> >
> > > -----Original Message-----
> > > From: Adrian Cearnau [mailto:ce...@ce...]
> > > Sent: 24 December 2002 12:50
> > > To: gam...@li...
> > > Subject: [GD-General] Overhead of RTTI
> > >
> > >
> > > Hey everyone and merry X-Mas,
> > >
> > > I'd like to know what the realistic overhead of enabling
> > RTTI in a C++
> > > project is. Any opinions are welcome.
> > >
> > > Thank you,
> > > Adrian 'cearny' Cearnau
> >
> >
> >
> > -------------------------------------------------------
> > This sf.net email is sponsored by:ThinkGeek
> > Welcome to geek heaven.
> > http://thinkgeek.com/sf
> > _______________________________________________
> > Gamedevlists-general mailing list
> > Gam...@li...
> > https://lists.sourceforge.net/lists/listinfo/gamedevlists-general
> > Archives:
> > http://sourceforge.net/mailarchive/forum.php?forum_id=557
> >
> >
> >
> >
> > -------------------------------------------------------
> > This sf.net email is sponsored by:ThinkGeek
> > Welcome to geek heaven.
> > http://thinkgeek.com/sf
> > _______________________________________________
> > Gamedevlists-general mailing list
> > Gam...@li...
> > https://lists.sourceforge.net/lists/listinfo/gamedevlists-general
> > Archives:
> > http://sourceforge.net/mailarchive/forum.php?forum_id=557
> >
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Gamedevlists-general mailing list
> Gam...@li...
> https://lists.sourceforge.net/lists/listinfo/gamedevlists-general
> Archives:
> http://sourceforge.net/mailarchive/forum.php?forum_id=557
>
|