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: [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


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