使用XCode 3.2.3(64位),我得到以下奇怪的输出。我究竟做错了什么?typeid运算符的奇怪行为?
#include <iostream>
#include <typeinfo>
struct student {
};
int main()
{
int i;
student obj;
std::cout << typeid(i).name() << "\n";
std::cout << typeid(obj).name() << "\n";
return 0;
}
输出:
i
7student
你说这是错的 - 你期望看到什么? – Mark 2011-01-10 00:04:29