From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18235 invoked by alias); 17 Sep 2013 19:50:12 -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 18226 invoked by uid 89); 17 Sep 2013 19:50:12 -0000 Received: from mail-ie0-f169.google.com (HELO mail-ie0-f169.google.com) (209.85.223.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 17 Sep 2013 19:50:12 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.4 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,NO_RELAYS autolearn=ham version=3.3.2 X-HELO: mail-ie0-f169.google.com Received: by mail-ie0-f169.google.com with SMTP id tp5so11390688ieb.0 for ; Tue, 17 Sep 2013 12:50:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=tN3LsqMFZF0fi0wxpDN0CuMtf4HmxsMba8g0sOXoGH8=; b=VHfJ29/OW7IhpPlcLH+mvoU+/WjuwWG/4Nz22OY4BuoNBXfxsvHzv4NI291wcMXkPu 40hMzslkZyuptmuWTmK7bczMbdRp80mUlp5z6cVmJhkFKbwPFWdFT3FZkmD2y+Z8hSDW UzEe+cXsLI8ir7ExejdpHydbfaPhABqmMszZdZXCMhmXJhH8iekFHZdmJK9vj+/b2aNV xLSI1hSd/4KHQBYrqQqqcXkO5f8ThiPfDFU2OqVj6INF6LiD4VtooI9Zl5tnBeqZdIM2 k7OrICmaHPyoIT8DrE+5UpTIWDyGNZDEhJC8Or4DkbQqVG4PHp2AJ/E2uJZI+yT6tQoq nfrg== X-Gm-Message-State: ALoCoQlqbF8wMJRGUIXTaDTY3u5c3yLsxQ1Xu54mYE+h7mnzuBGRjK+f1qEGzn2HOsTjROeZA58n9JTiWRJncCeoQbcr1k7D5Oy6rAKmphZKEklBCig238rOI5DC8Ei/71HSKrWnGbKDRaGrgdCdcD3U5hVbjOZZwFVW7nsxaQCLv7jCvnUwHoJdrpORZwD7DXwXqc3GMq87HcOK86NwIB+3WOlbjB1XHA== MIME-Version: 1.0 X-Received: by 10.42.61.196 with SMTP id v4mr8140923ich.21.1379447409587; Tue, 17 Sep 2013 12:50:09 -0700 (PDT) Received: by 10.64.31.100 with HTTP; Tue, 17 Sep 2013 12:50:09 -0700 (PDT) In-Reply-To: <20130917193713.GA26005@host2.jankratochvil.net> References: <20130915193742.GA20411@host2.jankratochvil.net> <21047.33940.998451.19883@ruffy.mtv.corp.google.com> <20130917064841.GA18677@host2.jankratochvil.net> <87txhjxr0b.fsf@fleche.redhat.com> <878uyvw8f3.fsf@fleche.redhat.com> <20130917193713.GA26005@host2.jankratochvil.net> Date: Tue, 17 Sep 2013 19:50:00 -0000 Message-ID: Subject: Re: [patchv3 1/5] Mostly code cleanup: Constification From: Doug Evans To: Jan Kratochvil Cc: Tom Tromey , gdb-patches Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes X-SW-Source: 2013-09/txt/msg00551.txt.bz2 On Tue, Sep 17, 2013 at 12:37 PM, Jan Kratochvil wrote: > On Tue, 17 Sep 2013 21:32:48 +0200, Tom Tromey wrote: >> >>>>> "Doug" == Doug Evans writes: >> >> Doug> What's wrong with utility wrappers? >> >> In the general case they require the introduction of a new function, a >> new type, and marshalling and unmarshalling code. This is verbose and >> error prone. >> >> I suppose catch_command_errors* aren't quite so bad. They're rather trivial, and abandoning them is isomorphic (IMO) to asking people to instead duplicate their contents. Sounds like the definition of a good wrapper, or any utility function really. [There is a discussion to be had about print_any_exception, but that's just cleanup ...] > * catch_command_errors* use non-public function print_any_exception() with > unclear differences from the public function exception_print(). Plus I saw a call to target_terminal_ours. Not sure it's present on all code paths. > * The body of catch_command_errors* is several lines of code which is rather > questionable whether it is worth wrapping in a function. A better measure is how many lines of code is there to use it versus not use it? [Plus, all else being equal, wouldn't the larger the amount of code that can be replaced with a subroutine call improve the worthiness of creating a utility function?]