当前位置:网站首页>On the method of outputting the complete name of typeID from GCC

On the method of outputting the complete name of typeID from GCC

2022-04-23 17:41:00 On computer knowledge

This is my previous article :
https://www.cnblogs.com/jisuanjizhishizatan/p/16149500.html

about typeid, You can use the following method to output its name , Essentially name() Method returns a string String of type .

cout<<typeid( Variable name ).name<<endl;

In different environments , Different results are output . about VC Compilers like that , The output is the full name . In some compilers , The output is only a single letter .

Such as , Only output i.

For the method of how to output the full name , I also did a simple search on the Internet , Finally found cxxabi.h A function of :

cout<<abi::__cxa_demangle(typeid( Variable name ).name(),0,0,0)<<endl;

This is the test code , For the output of the function pointer :

版权声明
本文为[On computer knowledge]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231740108427.html