This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patchv3 1/5] Mostly code cleanup: Constification
- From: Doug Evans <dje at google dot com>
- To: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Cc: Tom Tromey <tromey at redhat dot com>, gdb-patches <gdb-patches at sourceware dot org>
- Date: Tue, 17 Sep 2013 12:50:09 -0700
- Subject: Re: [patchv3 1/5] Mostly code cleanup: Constification
- Authentication-results: sourceware.org; auth=none
- References: <20130915193742 dot GA20411 at host2 dot jankratochvil dot net> <21047 dot 33940 dot 998451 dot 19883 at ruffy dot mtv dot corp dot google dot com> <20130917064841 dot GA18677 at host2 dot jankratochvil dot net> <87txhjxr0b dot fsf at fleche dot redhat dot com> <CADPb22RYYAjOtkND94WzUg-LkjngGPEWd74r50PidHgo16QX4A at mail dot gmail dot com> <878uyvw8f3 dot fsf at fleche dot redhat dot com> <20130917193713 dot GA26005 at host2 dot jankratochvil dot net>
On Tue, Sep 17, 2013 at 12:37 PM, Jan Kratochvil
<jan.kratochvil@redhat.com> wrote:
> On Tue, 17 Sep 2013 21:32:48 +0200, Tom Tromey wrote:
>> >>>>> "Doug" == Doug Evans <dje@google.com> 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?]