public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Varun Kumar E <varunkumare99@gmail.com>
To: libstdc++@gcc.gnu.org
Subject: RTTI names for classes in anonymous namespaces
Date: Wed, 23 Aug 2023 14:10:50 +0530	[thread overview]
Message-ID: <CAAJX8EkWKXjrd0E13-E2podQwznhSL8-DuAujUzBTwy9-jxgCg@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1096 bytes --]

 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

             reply	other threads:[~2023-08-23  8:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-23  8:40 Varun Kumar E [this message]
2023-08-23  8:54 ` Jonathan Wakely
2023-08-23  8:59   ` Jonathan Wakely
  -- strict thread matches above, loose matches on Subject: below --
2023-08-23  8:19 Varun Kumar E
2023-08-23  8:48 ` Jonathan Wakely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAAJX8EkWKXjrd0E13-E2podQwznhSL8-DuAujUzBTwy9-jxgCg@mail.gmail.com \
    --to=varunkumare99@gmail.com \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).