This is the mail archive of the
mailing list for the GDB project.
Re: [RFA] clean up temp sals in handle_inferior_event
- From: Stan Shebs <stan at codesourcery dot com>
- To: tromey at redhat dot com
- Cc: Michael Snyder <msnyder at vmware dot com>, "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Tue, 21 Jul 2009 10:57:36 -0700
- Subject: Re: [RFA] clean up temp sals in handle_inferior_event
- References: <4A63D5B4.firstname.lastname@example.org> <email@example.com>
Tom Tromey wrote:
I'd find it easier debuggingwise to have fewer of the small scopes,
*but* to give the sals different names indicating their roles. For me
the confusion comes from using a single variable name in a function to
mean several different things, whether or not each is in a different scope.
"Michael" == Michael Snyder <firstname.lastname@example.org> writes:
Michael> There were seven, and now eight, places in handle_inferior_event
Michael> where a local struct symtab_and_line is declared and used briefly.
Michael> One of them even opens and closes a block just for this purpose.
Michael> This patch merges those all into a single local temp variable.
Michael> They all initialize it, and all but one of them returns after
Michael> using it, so they can't interact. Plus I ran the testsuites
Michael> with no regressions.
I find the old code clearer. In the old code, these temporary variables
are mostly declared in small blocks surrounding their point of use.
This means that it is very easy to reason about the variable: its entire
lifetime fits onto the screen at once.