RE: [GD-General] Overhead of RTTI
Brought to you by:
vexxed72
From: Tom F. <to...@mu...> - 2002-12-24 14:12:34
|
I would modify that to: "inheritance of multiple virtual classes is evil". Multiple inheritance is just fine and dandy, as long as only one (or none) of the parent classes is a virtual class. 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: Grills, Jeff [mailto:jg...@so...] > Sent: 24 December 2002 13:55 > To: 'gam...@li...' > Subject: RE: [GD-General] Overhead of RTTI > > > > I didn't quite understand your email, so this comment may not > apply to your > case. You can't dynamic_cast<> from a void*. You have to > have an object > that has a virtual function in it, and you should be casting > from a base > class of the desired target. > > And, as a general rule, multiple inheritance is evil and > should be avoided. > In fact, we've recently put a rule in place where any use of multiple > inheritance requires a lead programmer's permission before > submitting to > source control. > > j > > -----Original Message----- > From: Adrian Cearnau [mailto:ce...@ce...] > Sent: Tuesday, December 24, 2002 7:26 AM > 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 > |