G
Generic Usenet Account
My C++ compiler (gcc 3.3.1) is prefixing a number in front on a
user-defined structure when I invoke typeid() on it. Can anyone
explain why? [Look at the funny thing I have to do in the macro
definition to get rid of that]
Source code follows:
Bhat
////////////////////////////////////////////////
#include <iostream>
#include <typeinfo>
#include <strings.h>
using namespace std;
#define TYPEID(x) cout << #x << ": " << strpbrk(typeid(x).name(),
"_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") << endl;
struct sampleStruct
{
char c;
short s;
int i;
};
int
main()
{
TYPEID(sampleStruct);
sampleStruct whatsmytype;
TYPEID(whatsmytype);
}
user-defined structure when I invoke typeid() on it. Can anyone
explain why? [Look at the funny thing I have to do in the macro
definition to get rid of that]
Source code follows:
Bhat
////////////////////////////////////////////////
#include <iostream>
#include <typeinfo>
#include <strings.h>
using namespace std;
#define TYPEID(x) cout << #x << ": " << strpbrk(typeid(x).name(),
"_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") << endl;
struct sampleStruct
{
char c;
short s;
int i;
};
int
main()
{
TYPEID(sampleStruct);
sampleStruct whatsmytype;
TYPEID(whatsmytype);
}