RTTI names for classes in anonymous namespaces
Varun Kumar E
varunkumare99@gmail.com
Wed Aug 23 08:40:50 GMT 2023
hello all,
The RTTI names generated by gcc for classes in anonymous namespaces
begin with the prefix asterisk(*).
Once the __name pointer is different why do we not return
immediately? Instead we perform a string comparison if the name does not
begin with asterisk(*).
Could you please explain the reasoning behind this.
code snippet below:
type_info::operator==(const type_info& __arg) const _GLIBCXX_NOEXCEPT
{
if (std::__is_constant_evaluated())
return this == &__arg;
if (__name == __arg.__name)
return true;
#if !__GXX_TYPEINFO_EQUALITY_INLINE
// ABI requires comparisons to be non-inline.
return __equal(__arg);
#elif !__GXX_MERGED_TYPEINFO_NAMES
// Need to do string comparison.
return __name[0] != '*' && __builtin_strcmp (__name, __arg.name())
== 0;
#else
return false;
#endif
}
Code link: typeinfo - gcc-mirror/gcc - Sourcegraph
<https://sourcegraph.com/github.com/gcc-mirror/gcc/-/blob/libstdc++-v3/libsupc++/typeinfo?L205>
regards,
Varun
More information about the Libstdc++
mailing list