This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
g++ 2.95 typeinfo::name()
- To: "'gcc at gcc dot gnu dot org'" <gcc at gcc dot gnu dot org>
- Subject: g++ 2.95 typeinfo::name()
- From: "Kellogg, Oliver" <Oliver dot Kellogg at vs dot dasa dot de>
- Date: Mon, 22 Jan 2001 12:56:09 +0100
Hi,
Is it correct that the typeinfo::name() method of g++-2.95
returns a number, i.e. the length of following characters,
prefixed to the actual name?
// This program:
#include <typeinfo>
#include <string>
#include <iostream>
class myclass {
public:
int i;
};
int main ()
{
string s;
myclass m;
s = typeid (m).name ();
cout << s.c_str () << endl;
return 0;
}
// produces:
// 7myclass
FYI, other C++ compilers, e.g. Rational C++ 3.0.0b,
return the name but without the length prefix.
Thanks,
Oliver M. Kellogg
-- oliver dot kellogg at vs dot dasa dot de