This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patchv3 1/5] Mostly code cleanup: Constification


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?]


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]