From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 75217 invoked by alias); 3 May 2019 22:57:27 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 74965 invoked by uid 89); 3 May 2019 22:57:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-6.1 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:741 X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 03 May 2019 22:57:26 +0000 Received: from [172.16.0.120] (192-222-157-41.qc.cable.ebox.net [192.222.157.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 6F9C11E180; Fri, 3 May 2019 18:57:24 -0400 (EDT) Subject: Re: [RFC 2/8] Use classes to represent MI Command instead of structures From: Simon Marchi To: Tom Tromey , Jan Vrany Cc: gdb-patches@sourceware.org, Didier Nadeau References: <20190418152337.6376-1-jan.vrany@fit.cvut.cz> <20190418152337.6376-3-jan.vrany@fit.cvut.cz> <87a7gd99bn.fsf@tromey.com> <63e52cee-7075-7127-6d28-33492252b4e8@simark.ca> Message-ID: <80330c3d-a08a-7f3b-f9e2-7a37540a1546@simark.ca> Date: Fri, 03 May 2019 22:57:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <63e52cee-7075-7127-6d28-33492252b4e8@simark.ca> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2019-05/txt/msg00088.txt.bz2 On 2019-05-03 6:49 p.m., Simon Marchi wrote: > On 2019-04-25 3:25 p.m., Tom Tromey wrote: >> Rather than returning a unique_ptr, I think this could directly return a >> scoped_restore_tmpl. Then, if m_suppress_notification is NULL, >> just use the address of a dummy variable instead. > > Or a gdb::optional? Oh, just saw that Tom suggested that too: > Alternatively, if all invoke methods have to start this way, make invoke > non-virtual and then have it do the setup and then call a virtual > do_invoke function. Then invoke can use a gdb::optional<...>. I think that's a good idea, but do_suppress_notification could return an optional in any case. Simon