c++ - Strange output of std::typeid::name() -


i used typeid type names of std::vector::size_type , 0 sized class following code (cppreference):

#include<iostream> #include <vector> #include <typeinfo>  using namespace std;  class {};  int main() {     vector<int> v(10);       vector<int>::size_type s = v.size();       a;       cout << typeid(s).name() << endl;     cout << typeid(a).name() << endl;  }; 

and got output:

m 1a 

i guess "1" before "a" result of empty base class optimization, "m" stand , normal?

i using following gcc version: g++ (ubuntu 4.4.3-4ubuntu5.1) 4.4.3

g++ uses implementation-defined naming types, offers utility c++filt make them human-readable:

$ ./test | c++filt -t unsigned long 

Comments