i am getting 1A as output, i expected A ??Code:#include<iostream>
#include<typeinfo>
using namespace std;
class A{};
int main()
{
A a;
cout<<typeid(a).name();
return 0;
}
Printable View
i am getting 1A as output, i expected A ??Code:#include<iostream>
#include<typeinfo>
using namespace std;
class A{};
int main()
{
A a;
cout<<typeid(a).name();
return 0;
}
Maybe "1A" is the linker name for your A class?
I've read that the C-style string you get back from name() in this case is non-portable between compilers.... basically implemetation dependent....
Just running a few test programs through MinGW for a second, the number in the first byte always seems to match the number of letters in the class name, which I would guess is the length, in bytes, necessary to hold the class name. I imagine someone better versed in these details would be better able to tell us something more definite.