From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id A596D3858C53 for ; Tue, 12 Jul 2022 10:21:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A596D3858C53 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-212-3sKzmIk0O_yMyoI1cs4BdQ-1; Tue, 12 Jul 2022 06:21:53 -0400 X-MC-Unique: 3sKzmIk0O_yMyoI1cs4BdQ-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 014958037AE; Tue, 12 Jul 2022 10:21:53 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.160]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F21EC492C3B; Tue, 12 Jul 2022 10:21:51 +0000 (UTC) From: Florian Weimer To: Pedro Alves Cc: David Malcolm , gcc@gcc.gnu.org Subject: Re: [RFC] Using std::unique_ptr and std::make_unique in our code References: <20220708204651.42624-1-dmalcolm@redhat.com> <6f183e53-02b9-9472-a5cc-9c57c5c0e898@palves.net> Date: Tue, 12 Jul 2022 12:21:50 +0200 In-Reply-To: <6f183e53-02b9-9472-a5cc-9c57c5c0e898@palves.net> (Pedro Alves's message of "Mon, 11 Jul 2022 11:56:52 +0100") Message-ID: <87zgheskap.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2022 10:21:58 -0000 * Pedro Alves: > For example, for the type above, we'd have: > > typedef std::unique_ptr pending_diagnostic_up; > > and then: > > - pending_diagnostic *d, > + pending_diagnostic_up d, > > I would suggest GCC have a similar guideline, before people start > using foo_ptr, bar_unp, quux_p, whatnot diverging styles. This doesn't seem to provide much benefit over writing uP d; and with that construct, you don't need to worry about the actual relationship between pending_diagnostic and pending_diagnostic_up. I think the GDB situation is different because many of the types do not have proper destructors, so std::unique_ptr needs a custom deleter. Thanks, Florian