0

Possible Duplicate:
Can I ungarble GCC's RTTI names?

I've started using code::blocks with gcc (just couldn't stand VS2010 any more) and although I'm satisfied over all, one thing what is definitely not as well done in gcc is that when I want use typeid I'm getting not the exact type name but some symbolic notation (why? why couldn't they go with type names?) anyway, I've heard that c++filt could help with this sort of problems but I don't now how to use it (or install it - do I have to download it?).

Community
  • 1
  • 1
smallB
  • 16,662
  • 33
  • 107
  • 151
  • 2
    The downvote is not from me, so I can't tell, but your question is not well phrased. Try not to include irrelevant details (like the fact that you "can't stand" VS), don't be negative about things you don't understand (like type-mangling), and if you've found a tool that you think fits your needs, use Google to get some information about it - it's quite obvious that if you don't have it, you'll need to get it from somewhere, and that somewhere is very likely to have documentation about how you use it. – Mat Oct 22 '11 at 10:39

1 Answers1

2

typeid returns a reference to a std::type_info instance so I presume that you are using its name() method.

To answer your question about why you are not getting "exact" type names: name() returns a implementation defined string so you shouldn't rely on it having any meaning. In particular, it doesn't even have to be unique to the type.

You should compare std::type_info objects directly using ==, != or .before(), possibly incombination with .hash_code() if you have C++11 support.

CB Bailey
  • 755,051
  • 104
  • 632
  • 656