关于c ++:std :: typeid :: name()的奇怪输出

Strange output of std::typeid::name()

我使用typeid来获取std :: vector :: size_type的类型名称和大小为零的类A,其代码如下(cppreference):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include<iostream>
#include <vector>
#include <typeinfo>

using namespace std;

class A {};

int main()
{
    vector<int> v(10);

    vector<int>::size_type s = v.size();

    A a;

    cout << typeid(s).name() << endl;
    cout << typeid(a).name() << endl;

};

我得到这个作为输出:

1
2
m
1A

我想" A"之前的" 1"是空基类优化的结果,但是" m"代表什么,这是正常现象吗?

我正在使用以下gcc版本:g ++(Ubuntu 4.4.3-4ubuntu5.1)4.4.3


G ++对类型使用实现定义的命名,但它也提供实用程序c++filt使其易于阅读:

1
2
3
$ ./test | c++filt -t
unsigned long
A