Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get exact type name for gcc #382

Closed
wants to merge 1 commit into from
Closed

Conversation

fxliang
Copy link
Contributor

@fxliang fxliang commented Jan 3, 2025

some test outputs (mingw build)
before

Type name: i
Type hash: 56c873f6b675de06
Type name: NSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Type hash: 502408f29ce5607d
Type name: N4test4DataE
Type hash: 348798779b4566a3
Type name: St6vectorIN4test4DataESaIS1_EE
Type hash: 651b5d818404316b
Type name: Pv
Type hash: 1a32248c3d1691ff

after

Type name: int
Type hash: 56c873f6b675de06
Type name: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >
Type hash: 502408f29ce5607d
Type name: test::Data
Type hash: 348798779b4566a3
Type name: std::vector<test::Data, std::allocator<test::Data> >
Type hash: 651b5d818404316b
Type name: void*
Type hash: 1a32248c3d1691ff

@hchunhui
Copy link
Owner

这里面的 name 是用来在运行时判断类型的(hash 并不保证唯一性),是比较高频次的操作,所以不希望做相对重型的 demangle 操作。另一个隐患是不清楚 demangle 以后类型是否会重名,即使不重名 demangle 以后的名字一般来说也更长,会增加类型的比较时间。

@fxliang fxliang closed this Jan 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants