Can I ungarble GCC's RTTI names?

后端 未结 3 1344
轮回少年
轮回少年 2021-01-12 23:53

Using gcc, when I ask for an object/variable\'s type using typeid, I get a different result from the type_info::name method from what I\'d expect to get on Windows. I Google

3条回答
  •  一整个雨季
    2021-01-13 00:26

    If it's what you're asking, there is no compiler switch that would make gcc behave like msvc regarding the name returned by type_info::name().

    However, in your code you can rely on the gcc specific __cxa_demangle function.

    There is in fact an answer on SO that addresses your problem.

    Reference: libstdc++ manual, Chapter 40. Demangling.

提交回复
热议问题