This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC/RFA] add struct parse_context to all command functions
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: tromey at redhat dot com
- Cc: brobecker at adacore dot com (Joel Brobecker), gdb-patches at sourceware dot org
- Date: Tue, 28 Oct 2008 19:42:08 +0100 (CET)
- Subject: Re: [RFC/RFA] add struct parse_context to all command functions
Tom Tromey wrote:
> Ulrich> - In some cases (e.g. print_subexp_standard) you have multiple instances
> Ulrich> within the same function where a local "opts" variable is created;
> Ulrich> maybe it would be clearer to have a common "opts" initialized once
> Ulrich> for the whole function?
>
> In a long function, like print_subexp_standard, I find it clearer to
> have variables declared as locally as possible, because it is simpler
> to see all the code referencing the local at once.
I agree, if the variables are really independent. In this case, my thought
was that we really want all parts of print_subexp_standard to use the *same*
consistent set of printing options, so it might make sense to make this
explicit by using a single variable to hold them. (Also, this would make it
simple to pull the options out as an argument, if we ever see the need for
invoking print_subexp_standard with different print modes ...)
But this is really just a minor issue; I'm fine with the way it is.
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com