This is a discussion on Re: scope reductions - SNMP ; On Sun, Mar 04, 2007 at 06:07:08PM +0100, Magnus Fromreide wrote: > On s=F6n, 2007-03-04 at 13:55 +0100, Thomas Anders wrote: > > Magnus Fromreide wrote: > > > Are patches like the attached ones of interest for the project ...
On Sun, Mar 04, 2007 at 06:07:08PM +0100, Magnus Fromreide wrote:
> On s=F6n, 2007-03-04 at 13:55 +0100, Thomas Anders wrote:
> > Magnus Fromreide wrote:
> > > Are patches like the attached ones of interest for the project or sho=
> > > I just ignore such things when I see them?
> > =
> > Cleanup is always appreciated.
> > =
> > > The advantage of the patches is that they make the code more local so
> > > you do not have to keep track of lots of function scope variables, see
> > > for instance make-zone-local where there are two uses of the variable,
> > > 25 and 50 lines from the declaration or make-len-local where the use =
> > > 90 lines from the declaration.
> > > =
> > > make-len-local
> > > Move the len variable from function scope to the scope of the=
> > > clause where it i used.
> > > =
> > > make-zone-local
> > > Move the zone variable from function scopes of the two if
> > > clauses where it is used.
> > =
> > Don't these two patches introduce potential problems with C89 compilers?
> In both cases the declarations is at the start of a block, and as far as
> I know it have always been valid to declare variables at the start of a
> block, even if it is an inner block.
Steve the language lawyer concurs, with hearty applause: scope reductions
make code easier to understand and maintain.
Stephen J Friedl | Security Consultant | UNIX Wizard | +1 714 544-6561
www.unixwiz.net | Tustin, Calif. USA | Microsoft MVP | email@example.com
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
Net-snmp-coders mailing list