RTTI names for classes in anonymous namespaces.

Jonathan Wakely jwakely.gcc@gmail.com
Wed Aug 23 08:48:48 GMT 2023


On Wed, 23 Aug 2023, 09:19 Varun Kumar E via Libstdc++, <
libstdc++@gcc.gnu.org> wrote:

>  hello all,
>
>       The RTTI names generated by gcc for classes in anonymous namespaces
> begin with the prefix asterisk(*).

      Could you please explain the reasoning behind this?


It means that type_info equality can be determined by just comparing the
const char* pointers, instead of using strcmp to match equal names.

The pointer value will be unique, so will only compare equal to itself.


As Itanium ABI
> c++ has no mention of this.
>

The Itanium ABI doesn't dictate the form of those strings.

When you call std::type_info::name() the '*' is not in the result. It's
just an implementation detail.


More information about the Libstdc++ mailing list