From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 57200 invoked by alias); 1 Aug 2017 08:44:52 -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 56285 invoked by uid 89); 1 Aug 2017 08:44:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 01 Aug 2017 08:44:43 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id v718iaPO002739 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 1 Aug 2017 04:44:41 -0400 Received: by simark.ca (Postfix, from userid 112) id 63AFB1EA05; Tue, 1 Aug 2017 04:44:36 -0400 (EDT) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id 877981E5B1; Tue, 1 Aug 2017 04:44:35 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 01 Aug 2017 08:44:00 -0000 From: Simon Marchi To: Tom Tromey Cc: Simon Marchi , gdb-patches@sourceware.org, Pedro Alves Subject: Re: [RFA v2 10/24] Remove make_cleanup_restore_current_language In-Reply-To: <87o9s08d5d.fsf@tromey.com> References: <20170725172107.9799-1-tom@tromey.com> <20170725172107.9799-11-tom@tromey.com> <94022dcf-0cdb-f271-9b8c-66682ac41b1c@ericsson.com> <87o9s08d5d.fsf@tromey.com> Message-ID: <8b739d097d6deb346108f25d6f2eca92@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.3.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Tue, 1 Aug 2017 08:44:36 +0000 X-IsSubscribed: yes X-SW-Source: 2017-08/txt/msg00002.txt.bz2 On 2017-08-01 00:17, Tom Tromey wrote: > Simon> 2. should only only save and restore the current language, and > Simon> not set the new language. > > scoped_restore allows setting the new value. That's what I was copying > here. From scoped_restore.h: > > /* Create a new scoped_restore object that saves the current value > of *VAR, and sets *VAR to VALUE. *VAR will be restored when this > scoped_restore object is destroyed. This is templated on T2 to > allow passing VALUEs of types convertible to T. > E.g.: T='base'; T2='derived'. */ > template > scoped_restore_tmpl (T *var, T2 value) > : scoped_restore_base (var), > m_saved_value (*var) > { > *var = value; > } > > Tom I'd argue the same thing for scoped_restore, but if I'm the only one bothered by it, I can live with it. Simon