From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14426 invoked by alias); 29 Dec 2008 19:31:05 -0000 Received: (qmail 14418 invoked by uid 22791); 29 Dec 2008 19:31:04 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 29 Dec 2008 19:30:28 +0000 Received: (qmail 1077 invoked from network); 29 Dec 2008 19:30:26 -0000 Received: from unknown (HELO orlando.local) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 29 Dec 2008 19:30:26 -0000 From: Pedro Alves To: tromey@redhat.com Subject: Re: PR 7536 - ``set input-radix 1'' changes radix Date: Mon, 29 Dec 2008 19:31:00 -0000 User-Agent: KMail/1.9.10 Cc: gdb-patches@sourceware.org References: <200812290221.14557.pedro@codesourcery.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200812291930.26980.pedro@codesourcery.com> X-IsSubscribed: yes 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 X-SW-Source: 2008-12/txt/msg00451.txt.bz2 On Monday 29 December 2008 19:11:17, Tom Tromey wrote: > I also looked at this bug a little, and I was wondering whether we > should fix this generically, for all parameters, by saving the > parameter's value and then restoring it if the setter function raises > an error. What do you think of that? That's actually something that crosses my mind everytime I touch these set/validate functions. There are a couple of corner/tricky case that you would have to consider like QUIT (pagination makes that easy-ish to trigger), and the fact that it can happen before or after the setter having already done side effects; or, an error not meaning the setting didn't take effect. A codebase audit would probably be required to make sure side effects are unwound correctly, but it's probably doable. Another option would be to pass to the setter the new alreayd parsed value, and let it validate and set the final variable itself --- the setter code always knows what it it setting. The issue is that you either pass a variant, or have a different setter function type for each type of variable. -- Pedro Alves