public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: Pedro Alves <pedro@palves.net>
Cc: David Malcolm <dmalcolm@redhat.com>,
	gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH 1/2] Add gcc/make-unique.h
Date: Tue, 12 Jul 2022 19:58:10 +0100	[thread overview]
Message-ID: <CAH6eHdSyXzdQwtHDVMhYWYCQVtS0GpoSBycuGoC7_satKbPrbQ@mail.gmail.com> (raw)
In-Reply-To: <56684bbd-b056-ecd6-f01b-924b838ec3fe@palves.net>

On Tue, 12 Jul 2022 at 19:41, Pedro Alves <pedro@palves.net> wrote:
>
> On 2022-07-12 7:36 p.m., Pedro Alves wrote:
> > On 2022-07-12 7:22 p.m., Jonathan Wakely wrote:
> >>
> >>
> >> On Tue, 12 Jul 2022, 17:40 Pedro Alves, <pedro@palves.net <mailto:pedro@palves.net>> wrote:
> >>
> >>     On 2022-07-12 4:14 p.m., Jonathan Wakely wrote:
> >>
> >>     >>  So once GCC requires C++14, why would you want to preserve
> >>     >> once-backported symbols in a namespace other than std, when you no longer have a reason to?
> >>     >> It will just be another unnecessary thing that newcomers at that future time will have
> >>     >> to learn.
> >>     >
> >>     > I also don't see a problem with importing std::make_unique into
> >>     > namespace gcc for local use alongside other things in namespace gcc. I
> >>     > do consider that idiomatic. It says "the make_unique for gcc code is
> >>     > std::make_unique". It means you only need a 'using namespace gcc;' at
> >>     > the top of a source file and you get access to everything in namespace
> >>     > gcc, even if it is something like std::make_unique that was originally
> >>     > defined in a different namespace.
> >>     >
> >>
> >>     If that's the approach, then GCC should import std::unique_ptr, std::move,
> >>     std::foo, std::bar into the gcc namespace too, no?  Are you really going
> >>     to propose that?
> >>
> >>
> >> No, I don't follow the logic of "if you do it for one thing you must do it for everything". That's a straw man. But I don't really mind how this gets done. Your suggestion is fine.
> >>
> >
> > It isn't a strawman, Jon.  Maybe there's some miscommunication.  The conversion started (and part of it is
> > still quoted above), by thinking about what we'd do once we get to C++14, and my suggestion to optimize
> > for that.  When we get to the point when we require C++14, make_unique is no longer different from any other
> > symbol in the std namespace, and there will be no reason to treat it differently anymore.  Like, if someone at
> > that point proposes to remove the global make_unique or gcc::make_unique, and replace all references with
> > std::make_unique, there will be no real ground to object to that, why wouldn't you want it?  This is very
> > much like when you removed "gnu::unique_ptr" (not going to miss it) a few months back -- you replaced
> > it by "std::unique_ptr"; gnu::unique_ptr wasn't kept just because of history.
>
> Sorry to reply to myself -- but I'm not sure it is clear what I meant above in the last sentence, so let
> me try again: 'the "gnu::unique_ptr" wasn't rewritten as an import of std::unique_ptr into the gnu namespace
> just because of history.'

[OFFLIST]

I considered doing exactly that. But because namespace gnu wasn't used
anywhere else in GCC it didn't make sense. If it had been put in
namespace gcc, which is still used elsewhere in the GCC codebase, I
might have decided differently. But keeping namespace 'gnu' with no
content except 'using std::unique_ptr;' would have been pointless. It
wouldn't have made it easier for other things in namespace gnu to
refer to it, because there were no other things. It wouldn't have
allowed 'using namespace gnu;' to make various useful utilities
available with a single using-directive, because that would only make
one thing available, and 'using std::unique_ptr;' does that just as
effectively.

  reply	other threads:[~2022-07-12 18:58 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAH6eHdSnGwtScODMveYha1S5WiDo6YsexN_pRqe9n4vq-Pmkig@mail.gmail.com>
2022-07-12  0:25 ` David Malcolm
2022-07-12  0:25   ` [PATCH 2/2] analyzer: use std::unique_ptr for pending_diagnostic/note David Malcolm
2022-07-12  6:48   ` [PATCH 1/2] Add gcc/make-unique.h Jonathan Wakely
2022-07-12  8:13     ` Jonathan Wakely
2022-10-26 20:40     ` [PATCH v3] " David Malcolm
2022-11-02 21:45       ` Jason Merrill
2022-07-12 13:23   ` [PATCH 1/2] " Pedro Alves
2022-07-12 13:45     ` Jonathan Wakely
2022-07-12 14:06       ` Pedro Alves
2022-07-12 15:14         ` Jonathan Wakely
2022-07-12 16:40           ` Pedro Alves
2022-07-12 18:22             ` Jonathan Wakely
2022-07-12 18:36               ` Pedro Alves
2022-07-12 18:41                 ` Pedro Alves
2022-07-12 18:58                   ` Jonathan Wakely [this message]
2022-07-12 18:59                     ` Jonathan Wakely
2022-07-12 18:50                 ` Jonathan Wakely
2022-07-12 18:56                   ` Pedro Alves
2022-07-12 18:36             ` David Malcolm
2022-07-12 18:49               ` Pedro Alves
2022-10-21 16:01 David Malcolm
2022-10-25 23:00 ` David Malcolm

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=CAH6eHdSyXzdQwtHDVMhYWYCQVtS0GpoSBycuGoC7_satKbPrbQ@mail.gmail.com \
    --to=jwakely.gcc@gmail.com \
    --cc=dmalcolm@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=pedro@palves.net \
    /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).