From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) by sourceware.org (Postfix) with ESMTPS id CA51B3858412 for ; Mon, 11 Jul 2022 10:56:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CA51B3858412 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f52.google.com with SMTP id ay25so2814208wmb.1 for ; Mon, 11 Jul 2022 03:56:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=GQJFMmn+wBhxA96e9jNv5j/VvybALMT1iW5pZyzPnDg=; b=H8ehp4LSj86m8qO2uGmomftp20p64vhv8wJtrx/yrNU2t68SbVUzkDwIRYid43Z57Q I1ywCdN28PZn1hUsm4Mo451LZwErZHQlCHxcAEnaxzpF6YJSNngT/A4751cVLTBk13YO aSjFj59ag3N/qjobeT3dLQL0//lRJPa8Y5/Uqmy7/yO8pkUuGXyPsh/1604JjJU7OSqC 2Cq/bcwLFP5OqtcVZajO6tOR3dO5AfTQqc778iUWpMiTYJ0QPZE0onMZMaVxsm4oATNO yaZ22iaJ8aN0rUGzPd0Z2I4ZBedE8g30NJaRmgyPOcNuZMg+UHnNLHhOgKDQhEWTKx// UZNA== X-Gm-Message-State: AJIora8nr3zGErYFHrLzLIh5ISoCstX7BJ1DjXa7b9B95b8rOv9CLWtA dzBZKJB18UKydZ8zjWydV7NgrTMaF/k= X-Google-Smtp-Source: AGRyM1shYW4j9TBJ85e0PhbSZzioiI5PC1SiumAnytefGUEKeBym99fRqaYTz7O0vN0aWykEZL/PWg== X-Received: by 2002:a05:600c:3b23:b0:3a1:90d3:79ae with SMTP id m35-20020a05600c3b2300b003a190d379aemr15174871wms.69.1657537014385; Mon, 11 Jul 2022 03:56:54 -0700 (PDT) Received: from ?IPv6:2001:8a0:f924:2600:209d:85e2:409e:8726? ([2001:8a0:f924:2600:209d:85e2:409e:8726]) by smtp.gmail.com with ESMTPSA id c7-20020a05600c0ac700b003a2d47d3051sm7369639wmr.41.2022.07.11.03.56.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 11 Jul 2022 03:56:53 -0700 (PDT) Subject: Re: [RFC] Using std::unique_ptr and std::make_unique in our code To: David Malcolm , gcc@gcc.gnu.org References: <20220708204651.42624-1-dmalcolm@redhat.com> From: Pedro Alves Message-ID: <6f183e53-02b9-9472-a5cc-9c57c5c0e898@palves.net> Date: Mon, 11 Jul 2022 11:56:52 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20220708204651.42624-1-dmalcolm@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no 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: Mon, 11 Jul 2022 10:56:58 -0000 Hi! On 2022-07-08 9:46 p.m., David Malcolm via Gcc wrote: > - pending_diagnostic *d, > + std::unique_ptr d, I see that you didn't add any typedef for std::unique_ptr in this patch. It will be inevitable that people will start adding them, for conciseness, IME, though. To avoid diverging naming styles for such typedefs in the codebase, GDB settled on using the "_up" suffix (for Unique Pointer) quite early in the C++11 conversion, and we use such typedefs pervasively nowadays. 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. And it would be nice if GCC followed the same nomenclature style as GDB, so we could have one single guideline for the whole GNU toolchain, so people moving between codebases only had to learn one guideline. Pedro Alves