This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
Using typeinfo functions to determine RTTI
- To: gdb-patches at sourceware dot cygnus dot com
- Subject: Using typeinfo functions to determine RTTI
- From: Daniel Berlin <dan at cgsoftware dot com>
- Date: Tue, 2 May 2000 09:31:20 -0700 (PDT)
Sorry i've been inactive, i've been bogged down by finals the past two
weeks. I've got a boat load of patches for C++ to commit to the trunk.
But anyway, I have a question.
Does anyone mind if i use the typeinfo functio name, rather than the
virtual table name, to figure out th real type of an object? It only
matters if someone does -fno-rtti, i believe. But I have no idea how many
people actually use that flag to save time/space in debugging executables.
Here's a quick rundown of the reasons why i want to use it rather than the
virtual table name.
1. Main reason - The virtual table name is harder to parse, and not always
correct. You can end up with names like E::V virtual table, which becomes
almost impossible, in the face of namespaces, to determine the real type
of (IE i'd have to see if E was a namespace or a typename first). This
never happens with the typeinfo functions. For any object that is really
an E, it's always "E typeinfo function", and if it's in a namespace
"<namesapce>::E typeinfo function". So i can tell without having to do
symbol lookups and whatnot.
Here's the reason against it:
1. Virtual tables will always be there, typeinfo functions might not be,
depending on whether you give g++ some special flags or not.
Any strong feelings one way or the other?
Personally, i'd much rather use the type info functions.
--Dan