From: Keith Seitz <keiths@redhat.com>
To: Tom Tromey <tromey@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Use string_file::release in some places
Date: Fri, 22 Sep 2023 13:42:22 -0700 [thread overview]
Message-ID: <CAO90_uvJhXRGzJTKuOSzxW_qY5S35-HuP9Tfap4yZxZ-OVBiKA@mail.gmail.com> (raw)
In-Reply-To: <20230921194207.2401885-1-tromey@adacore.com>
On Thu, Sep 21, 2023 at 12:42 PM Tom Tromey via Gdb-patches
<gdb-patches@sourceware.org> wrote:
>
> I found a few spots like:
>
> string_file f;
> std::string x = f.string ();
>
> However, string_file::string returns a 'const std::string &'... so it
> seems to me that this must be copying the string (? I find it hard to
> reason about this in C++).
I admit, you now have me doubting everything I thought I remembered
on this subject! [TODO: reread the standard literature]
As far as I can tell, your assessment is at least consistent with what is
done elsewhere, e.g., location.c, ada-lang,c, and just about everywhere
else except the two locations you've identified in this patch.
Would symtab.c's symbol_to_info_string and valops.c:incomplete_type_hint
also qualify for similar treatment? They use addition assignment, so maybe
that alters the analogy?
In any case:
Reviewed-by: Keith Seitz <keiths@redhat.com>
Keith
next prev parent reply other threads:[~2023-09-22 20:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-21 19:42 Tom Tromey
2023-09-22 20:42 ` Keith Seitz [this message]
2023-09-25 9:40 ` Lancelot SIX
2023-09-26 12:59 ` Tom Tromey
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=CAO90_uvJhXRGzJTKuOSzxW_qY5S35-HuP9Tfap4yZxZ-OVBiKA@mail.gmail.com \
--to=keiths@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=tromey@adacore.com \
/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).